Friday, December 20, 2013

Silently re-connect to already mapped network drive?

When users connect through VPN we want to map their remote connections to as many local folders as possible.

To do this TASK SCHEDULER can monitor the VPN to see if a connection was made and fire off a script accordingly. The script can then map the corresponding drives to the local folders...

Silently re-connect to already mapped network drive?:

'via Blog this'

Wednesday, October 9, 2013

Revit area plans adding new types and references (Gross and rentable)

Note to self:

Add additional (duplicate) gross area and net area schemed under Area Plans


And Area schemes... Really counter-intuitive place to put this instead of say... 
Area Plans> New Type> Edit Type (ADD)
or Create an area plan, then Go to Properties, Edit Type and Duplicate...


Always seem to forget this one!

2015-10-16-And for the calculation type...
To update: this also applies to Revit as well as LT-

The gross calculations cannot be overridden, however the 'rentable' comes in various flavors... From AD Revit help:

Applies to Revit LT 2015

Rules are determined by one type of space bordering another space.
The following table shows area measurement rules. To find the appropriate measurement rule, find the selected Area Type and the corresponding Bordering Area Type.

Gross Building Area Scheme Types

Gross Building Area Scheme Types
Area Type SelectedBordering Area TypeMeasurement Rule
Gross Building Area
Gross Building AreaNoneArea Boundary measured to the outside surface of building.
Gross Building AreaExterior AreaArea Boundary measured from outside surface of building.
Exterior Area
Exterior AreaExterior AreaArea Boundary measured from wall centerline.
Exterior AreaGross Building AreaArea Boundary measured from outside surface of building.

Rentable Area Scheme Types

Note: Windows in Rentable Area Scheme Types: If you place windows within the exterior walls, Revit LT places the area boundary lines according to the following rules based on the height of the windows: If window height is greater than 50% of wall height, area boundary lines go to face of glass. If window height is less than 50% of wall height, area boundary lines go to interior face of the exterior walls.
Rentable Area Scheme Types
Area Type SelectedBordering Area TypeMeasurement Rule
Building Common Area
Building Common AreaBuilding Common Area, Office, StoreArea Boundary measured from wall centerline.
Building Common AreaExterior, Major Vertical PenetrationArea Boundary measured from wall face bordering Building Common Area.
Office Area
Office AreaBuilding Common Area, Office, StoreArea Boundary measured from wall centerline.
Office AreaExterior, Major Vertical PenetrationArea Boundary measured from wall face bordering the office area.
Exterior Area
Exterior AreaExteriorArea Boundary measured from wall centerline.
Exterior AreaStoreArea Boundary measured from wall face bordering Exterior Area.
Exterior AreaAny other areasArea Boundary measured from the wall face bordering the other area.
Floor Area
Floor AreaOffice, Store or Building Common AreaArea Boundary measured from wall face bordering other area.
Floor AreaExterior, Major Vertical PenetrationArea Boundary measured from the wall face bordering the floor area.
Floor AreaFloor AreaArea Boundary measured from the wall centerline.
Major Vertical Penetration
Major Vertical PenetrationMajor Vertical PenetrationArea Boundary measured from the wall centerline.
Major Vertical PenetrationExteriorArea Boundary measured from the wall face bordering the Major Vertical Penetration area.
Major Vertical PenetrationAny other area (except Exterior)Area Boundary measured from the wall face bordering the other area.
Store Area
Store AreaMajor Vertical Penetration, FloorArea Boundary measured from the wall face bordering the Store area.
Store AreaExteriorArea Boundary measured from the wall face bordering the Exterior area.
Store AreaBuilding Common Area, Office, StoreArea Boundary measured from the wall centerline.

Friday, October 4, 2013

Revit Central files to Local Files without a revit server

Right Click to create LOCAL files from CENTRAL files (not Revit Server)

The Issue:

Revit Central Files require users to create local files. Normally if you open a central file it asks if you want to create a local copy, but it doesn't replace *CENTRAL* with *LOCAL*.

First I started with a VBS that you can add to the right-click send to. This works pretty well, but I want better for my users and myself so I did a little research into registry and shell addins. Come to find out it isn't that difficult of a trick to manage.

The Solution:


and A script I created and have been modifying for years...

Always back up your registry prior to any registry additions!
This is a registry entry
in the (Default) Of the Command Of the Localize Central subkey...
WScript.exe  "\\YOUR_SERVER_AD_HERE.local]\_SCRIPT\Revit\REVIT_Localize.vbs" "%1"
The Registry entry looks more like this in the .REG file:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Revit.Project\shell\Localize Central\Command]
@="WScript.exe  \"\\\\[YOUR_SERVER_AD_HERE.local]\\_SCRIPT\\Revit\\REVIT_Localize.vbs\" \"%1\""
 Which adds a connect to the Script:
REVIT_Localize.vbs
Located:
 [YOUR_SERVER_AD_HERE.local]\_SCRIPT\Revit\
Where [YOUR_SERVER_AD_HERE.local] is the Active Directory (AD) path back to your local content set up with your IT department or as a common location to your scripts.  

SO WHAT HAPPENS??

With this in the registry, You get a shell extension like this when you right click any .rvt file:

By right-clicking and selecting Localize Central

WScript.exe

Executes the script
REVIT_Localize.VBS 

Passes the file with the "%1"

And the Script does the rest.



Friday, August 30, 2013

Sorry for the issue- the dynamic blog wasn't working very well

I reskinned my blog and the dynamic version didn't work too well - so I have dropped back to a simple version for now.

Wednesday, August 28, 2013

Ever had any stubborn text styles that wouldn't delete? I did- so I went to Boost Your BIM - Scrubbing Out Dimension Styles and adapted the code there to substitute one text style for another in my first useful macro! 

Start with a sample of text with the text style you want to replace, also add a sample of text style you want to match.

On runing the macro- it prompts in the STATUS BAR (tough to see - working on that) to select a text to replace, then the ext to match. Once completed you can run a purge and Voila! those peskt text styles should be available to purge!

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.UI.Events;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;



        public void TextSytleScrub()
        {
            Document doc = this.ActiveUIDocument.Document;
            UIDocument uidoc = new UIDocument(doc);
      
            // Prompt user to select a -text- with an unwanted style
            TextNote selected = doc.GetElement (uidoc.Selection.PickObject (ObjectType.Element , "Select -text- with style to scrub.")) as TextNote ;
            // Get name of the -text- style of this -text-
            string toScrub = selected.TextNoteType.Name;
      
            // Find the -text- style named "Default" which will be used to replace the unwanted style
            // There must be a style named "Default" for this command to work

      
            TextNote replacement = doc.GetElement (uidoc.Selection.PickObject (ObjectType.Element , "Select -text- with replacement style.")) as TextNote ;
            // Get name of the -text- style of this -text-
            string toreplace = replacement.TextNoteType.Name;
          
            TextNoteType defaultType = (from v in new FilteredElementCollector(doc)
                                        .OfClass(typeof(TextNoteType))
                                        .Cast<TextNoteType>()
                                        where v.Name == replacement.TextNoteType.Name select v).First();
          
            using (Transaction t = new Transaction(doc,"Change -text- style to default"))
            {
                t.Start();
                // loop through all -textnote- with the unwanted style
                foreach (TextNote textnote in (from v in new FilteredElementCollector(doc).OfClass(typeof(TextNote)).Cast<TextNote>()
                                      where v.TextNoteType.Name == toScrub select v))
                {
                    // change the -textnote-'s style to the default style
                    textnote.TextNoteType = defaultType;
                }
                t.Commit();
            }
      
            // Text in unplaced groups will not be found by the code above.
            // So we need to place an instance of each of these groups, find any -textnote- in the group, and change their style if needed
            foreach (GroupType groupType in new FilteredElementCollector(doc).OfClass(typeof(GroupType)))
            {
                // if there are already instances of the group then skip to the next group type
                 if (groupType.Groups.Size > 0)
                     continue;
                 using (Transaction t = new Transaction(doc,"Change -textnote- style in unplaced groups"))
                 {
                    // use this flag to track if any -textnote- have been changed
                    bool flag = false;
                    t.Start();
      
                    // place an instance of the group
                    Group newGroup = doc.Create.PlaceGroup(XYZ.Zero, groupType);
      
                    // loop through all members in the group
                    foreach (ElementId id in newGroup.GetMemberIds())
                    {
                          // identify any -textnote- in the group
                          TextNote textnote = doc.GetElement(id) as TextNote;
                          if (textnote !null)
                          {
                              // check if this dimension has the unwanted type
                              if (textnote.TextNoteType.Name == toScrub)
                              {
                                  // change the dimension type to the default type
                                  textnote.TextNoteType = defaultType;
                                  flag = true;
                              }
                          }
                    }
                    doc.Delete(newGroup.Id); // delete the newly placed group
                    if (flag)
                          t.Commit(); // commit this transaction if any -textnote-s were changed
                    else
                          t.RollBack(); // no -textnote-s were changed, so throw away the entire transaction
                 }
            }  
        }

Friday, August 23, 2013

Revit and the arch top, the language of arc segments and chord math.

Archtop windows that break... Revit has issues with circles. Sometimes it is very slick in how it maintains fillets, arcs connections and tangential references, other times it flips out at some of the simplest things, and these issues are sometimes random.

The basic language, spring point, rise, radius, intrados, top, creast are for simple arches.

This in geometric language is represented in Dr. Math's pages and on this reference to Chord Math from Open  Math website.

So we need to draw an arc- then make it flex so the width varies, but the rise is the same.


Simple enough right? Until this happens...
same family - at random points flips the arc:

I cannot even begin to explain why this happens.Guessing a glitch in Revit.

I have a workaround-  or more regular results anyways- by teaching Revit Arc's and arches fundamental language:

ARCH_r  = (Width ^ 2 + 4 * H ^ 2) / (8 * H)
Where:

r          is the radius of the arc
Width  is the width of the Chord (flat part)

Add this with a little resolution checking, and a variable origin and you should have a stable arc or arch:

Is tied to this detail family:


The trick is to move the origin (red arrow) which is also the geometric chord segment, 
based on the circle crest/top of arch (intrados) relative to the radius of the circle. 

So the circle center stays put- while the flex of the width drives the circle radius, and the Top reference plane.

The top reference plane is constrained back to the reference plane for the Center Elevation (CELE for short) marked by the red arrow with the H or Height of the chord segment. This is the rise of the arch.

The invisible lines are locked to the circle and the CELE reference plane. So in the detail component flexing the width raises the TOP reference plane. Which in turn drags the CELE reference plane. Left, right and center reference planes are set as references, while the construction "reference line" circle is set to not a reference.

Once the detail is in place the chord appears to stay put while the arc width changes.

One last tidbit.

if(not(Width / 2 > Arch Rise), Width / 2, Arch Rise)

If the Width /2 is less than or equal to Arch Rise, then use Width/2 to reference the intrados/crest/top of the arch, otherwise the arch will bulge out beyond creating a moorish arch:

Which you can allow if you wish by setting the H parameter equal to Arch Rise.

Friday, July 5, 2013

don't think: Do Revit: +/- offset(s) for families

don't think: Do Revit: +/- offset(s) for families:

'via Blog this'

Step by step solution to +/- offset values for families.

Parallel to the reference/surface point(A):
  1. Create a reference plane in the + offset direction,
  2. Call it "REF.OFFSET+"
  3. Dimension from the reference point(A) to the plane.
  4. Give the dimension a parameter "OFFSET.FRONT" (group it under 'other')
  5. Between point(A) and the reference plane, create another reference plane.
  6. call it "REF.OFFSET-"
  7. Create a dimension between the reference plan from step 1 and the one just created in step 3.
  8. Given the dimension a parameter "OFFSET.BACK" (group it under 'other')
  9. In the family properties, Create a Length parameter called "OFFSET".

  10. Next to the "OFFSET.FRONT"  under 'other' group, add the formula:
if(OFFSET > 0', OFFSET, 0')

  11. Next to the "OFFSET.BACK"  under 'other' group, add the formula:
if(NOT(OFFSET > 0'),abs( OFFSET), 0')

Try flexing with 1'-0" and -1'-0" to make sure it works properly.

*Make sure you reference "REF.OFFSET-" plane as that is what flexes forward and backwards!

Tuesday, May 28, 2013

Revit section head tags- keeping the division line horizontal

The horizontal line that always remains perpendicular to the 'project north' - is hard-coded into the family- so don't delete it otherwise you will find yourself having to copy-paste all your section head text and fills back into a NEW 'section head family'.

If you want your text to align with the section line... that's another story.

Thursday, May 23, 2013

Applied Software Blog: Revit 2014 NEW Feature.... WOW!

Applied Software Blog: Revit 2014 NEW Feature.... WOW!: Controlling the Selection of Elements So what is one of the new features in Revit 2014 that made me think "Wow, I didn't know I w...

Wednesday, May 22, 2013

Google earth, Revit and a CSV for some quick geomancy topography for Revit

USGS Web Query VIA Google earth-

I had a request by a friend to update this- I need to get my programming skills more in tune with an independent app. If you make any changes or additions please email me back. This is not for distribution and is for reference purposes only : )

If anyone uses this, please drop me a line back. If you want to change it and adapt it please send the changes and adaptations back here so we can share it back!

https://docs.google.com/file/d/0B3kxZYz7z9XSS0VxX1RUSTVlbUk/edit?usp=sharing



buildz: Louvers that know their orientation

This could be helpful... Need to research if there is a programming component to this- would be relatively easy to set a model component with a hosted tag set to align with element in the tag to keep a tru north/magnetic north pointing the correct way...

Or for that matter - look for view ports and adjust the view title accordingly...

buildz: Louvers that know their orientation: "http://funxploration.blogspot.com/2011/08/self-adjusted-opening-panels.html"


Fun Xploration: Self Adjusted Panel Openings:

'via Blog this'

Monday, May 6, 2013

Friday, April 12, 2013

Revit On Startup (Internal macros)

For follow up looking for a way to run a command once an addin is loaded into Revit or Navis Works. It is possible through the revit macros- still searching for an API version:

From: http://boostyourbim.wordpress.com/2013/01/06/using-module_startup-to-run-macro-code-when-revit-starts/

January 6, 2013


Using Module_Startup to run macro code when Revit starts

Filed under: Error Handling, PerformanceAdviser — harrymattison @ 10:00 am

In previous posts, I have recommended staying away from this code that Revit creates in your macro file. Now I will explain a situation when we need to get into it.



private void Module_Startup(object sender, EventArgs e)

{

}The short summary is that code in Module_Startup runs automatically when Revit starts. It can be useful for subscribing to events, registering updaters for Dynamic Model Update, and for using the FailureDefinition.CreateFailureDefinition which is why it is relevant to this series of posts on PerformanceAdviser.



While working on a code sample to run a custom rule with the Performance Adviser, I ran the macro and Revit threw this exception:







The RevitAPI.chm help file tells us more about this restriction of FailureDefinition.CreateFailureDefinition:



The newly created FailureDefinition will be added to the FailureDefinitionRegistry. Because FailureDefinition could only be registered when Revit starting up, this function cannot be used after Revit has already started. Throws InvalidOperationException if invoked after Revit start-up is completed.



So we can’t start Revit normally and then, in the middle of our Revit session, run a macro that registers a FailureDefinition. Therefore we need a way to do this registration when Revit starts.



The Revit API Wiki provides the solution:



The Module_Startup method is called when a module loads and Module_Shutdown is called when a module unloads. For Application-level macro modules, Module Startup is called when Revit starts



So I move the code that calls CreateFailureDefinition from my RunRoomRule macro into Module_Startup. (RunRoomRule will be discussed in its own upcoming post). My Module_Startup now looks like this:



private void Module_Startup(object sender, EventArgs e)

{

// Get the one instance of PerformanceAdviser in the Application

PerformanceAdviser pa = PerformanceAdviser.GetPerformanceAdviser();



// Create an instance of the RoomNotEnclosed rule class. Calling the RoomNotEnclosed() constructor is what calls CreateFailureDefinition.

RoomNotEnclosed roomNotEnclosed = new RoomNotEnclosed();



// Add this roomNotEnclosed rule to the PerformanceAdviser

pa.AddRule( roomNotEnclosed.Id, roomNotEnclosed );

}But when I compile my macro code I get the same exception shown in the screenshot above! Why? Because, in addition to Module_Startup running when Revit starts, it is also called when the macro project is rebuilt.



This creates a bit of a puzzle. I need to move the code to Module_Startup to only have it run when Revit starts. But to do this I need to compile the macro in the middle of my Revit session. But compiling the code in the middle of the Revit session fails because it calls Module_Startup.



The way out of this situation is to add try/catch handling of this exception. I have written about try/catch before and noted that, in general, for this blog I am not going to catch every exception that might occur. But here I have no choice. The exception that occurs during compilation needs to be caught so that compilation can succeed. On startup, the exception will not occur because at that time it will be legal to call CreateFailureDefinition.



The final code is:



private void Module_Startup(object sender, EventArgs e)

{

try

{

// Get the one instance of PerformanceAdviser in the Application

PerformanceAdviser pa = PerformanceAdviser.GetPerformanceAdviser();



// Create an instance of the RoomNotEnclosed rule class

RoomNotEnclosed roomNotEnclosed = new RoomNotEnclosed();



// Add this roomNotEnclosed rule to the PerformanceAdviser

pa.AddRule( roomNotEnclosed.Id, roomNotEnclosed );

}

// Need to catch this exception because otherwise Revit will throw every time this is compiled because

// Module_Startup and Module_Shutdown are called when the macro project is compiled.

// And because the macro project will compile in the middle of the Revit session, calling RoomNotEnclosed()

// will throw because it calls CreateFailureDefinition

catch (Autodesk.Revit.Exceptions.ApplicationException)

{}

}

(In my initial code I was catching the InvalidOperationException which is the specific sub-class of Autodesk.Revit.Exceptions.ApplicationException that is thrown by CreateFailureDefinition. But there is also another exception to deal with, an ArgumentException that occurs when the failure definition id has already been used to register an existing failure definition. ApplicationException is the parent class of both InvalidOperationException and ArgumentException, so catching ApplicationException takes care of both cases)



jaw-dropping renderer: Indigo for Revit

Wonder how much CPU time it took to render?
http://www.indigorenderer.com/book/export/html/1239


Indigo 3.4 header image

Wednesday, January 30, 2013

Powerpoint 2007 - saving to *.PPTX

Ran into a hiccup in powerpoint 2007 when creating an automated import for navis works xml files- you can't save to pptx, and I didn't want the added macro stuff to go with each new file - so I dug and found this trick at +help.wugnet.com

Sub TestSaveas()
  SaveAs "c:\somefilepath\"
End sub

Private Sub SaveAs(fp As String)
   Dim dlgSaveAs As FileDialog
   Dim strMyFile As String

   Set dlgSaveAs = Application.FileDialog(msoFileDialogSaveAs)
   With dlgSaveAs
       .InitialFileName = fp
       If .Show = -1 Then
           strMyFile = .SelectedItems(1)
           Application.ActivePresentation.SaveAs strMyFile
           'MsgBox strMyFile
           ''-- save your file to strMyFile here
       Else
           MsgBox "File not saved"
       End If
   End With
   dlgSaveAs.Execute
   Set dlgSaveAs = Nothing
End Sub

The execute is critical (and missing off microsoft's site) otherwise it throws a DLL error.