December 30, 2013

Revit: Restricting a User-Input Value to a Specific Increment

There are times when you are creating a family to represent an object that can have multiple values for a particular parameter, such as a length, that you would prefer not to create a type for each possible length. Using an instance-based parameter allows you to do so, as this allows the end user to set the value as needed on each instance. But what if the object you are modeling only comes in specific increments? How can you prevent the end user from entering a value that is not available? You can add another instance-based parameter and by entering a formula, you can round the user-input value to the desired increment. If the user could enter values that would be invalid, such as zero or negative values for a length parameter, or a value outside of the range available for the object, you can add one or more additional instance parameters and use a formula to assure an invalid value is not used.

As an example, I created an upside-down "T" shaped Generic Model Family, where the length is restricted to 6" increments, while the width can be any value.
The rounding functions in Revit®, Round, Roundup and Rounddown, require a unit-free number as an argument, so in the formula for the LengthRounded parameter, the user-input value is divided by 6". This value is then rounded (up in this case) and that result is multiplied by 6" to restore the units and get the rounded value. The LengthActual parameter then checks the rounded result and passes that value through if it is greater than 0 feet; otherwise the minimum value of 6" is set. The Length Actual parameter is what drives the family geometry.

Since formula-driven, instance-based length parameters will not generate stretch grips in Revit, I added an additional reference plane, UserInputEnd, and assigned the LengthUser parameter to a dimension between it and the Front reference plane so that stretch grips for the length would appear in a project. None of the family geometry is locked to the UserInputEnd reference plane. You can see the family and the family in a project in the following Chronicle.

December 21, 2013

ACA: Custom Drawing Scales, The Movie

I was trying out the new version of Project Chronicle and decided to base my first video on my previous blog article. So if you prefer watching video to reading text with the occasional screen shot, take a look at the video below. You may notice a "jump" in the video after the first custom scale is added. I figured that after seeing one scale added, there would be little interest in watching me type in the five other scales, so I cut that part out of the video.

December 19, 2013

ACA: Custom Drawing Scales

The easiest way to add drawing scales that you want available for all drawings is is to use the SCALELISTEDIT command (on the Annotate ribbon tab, Annotation Scaling panel, Scale List tool; or on the Drawing Window Status Bar, use the Annotation Scale control and select the Custom item on the popup list) to add these scales to your drawing template files. This will not, of course, affect any existing drawing files that you have.

"Vanilla" AutoCAD® offers the ability to customize the default scale list, with separate lists for Metric- and Imperial-unit drawings, by selecting the Default Scale List button in the Options dialog, on the User Preferences tab.
These lists are stored in the registry and are used by the Reset button in the Edit Drawing Scales dialog. If you use this feature to put additional scales in the default list(s), you can then use the Reset button to get these scales in an existing drawing using the SCALELISTEDIT command.

AutoCAD®Architecture, on the other hand, does not offer the ability to edit a default scale list,
and even if you run ACA as AutoCAD, changes made to the default lists then will not be honored when later running ACA as ACA. You can still use the SCALELISTEDIT command to add drawing scales to your template file(s), so that new files created with that(those) template file(s) will have them.

In order to avoid having to add the additional scale(s) manually to existing files, you can start a new file from your edited template file. Set one of the added scales current, and add an annotative MText object. If you have more than one added scale, select the MText object, right click, and choose Annotative Object Scale > Add/Delete Scales from the context menu.
Use the Add button in the Annotation Object Scale dialog, and select the additional scales in the Add Scales to Object dialog.
Select OK twice to add the scales to the MText object. You can now either save this file or use the WBLOCK command to create a file that containes the MText object. Use the INSERT command to insert this file into any other file in which you wish to add the custom scales, and the scales will come along for the ride. You can even cancel the INSERT command when prompted for the insertion point for the block, and then purge the block definition from the file - the added scales will remain.

December 17, 2013

Revit Phasing and Demolition: Required Reading

The need for a demolition phase has been a topic of discussion in my office. I do not see the need, in general, and feel that it creates more work to show essentially the same thing. Steve Stafford says it better than I can, so if you are dealing with this issue as well, you may want to read his article on the subject. There is additional discussion in the comments on that article, so be sure to read those, as well.

December 14, 2013

ACA: File Select Dialogs Open Slowly

I had been noticing that the file dialogs in AutoCAD® Architecture 2010 were opening somewhat slowly over the last several months and became exceptionally slow this past Wednesday. I was not experiencing that issue in ACA 2014. I suspected that somewhere in my Options I had a bad file/folder reference or a folder that had a broken Windows shortcut in it. Things were so bad that after I completed the task at hand, I took the time to check out each reference, but did not find any problems. I was about to give up, when the problem planted itself right in front of me and amazingly enough I recognized it.

I make extensive use of the fact that AutoCAD allows you to save the current folder in the "shortcut bar" at the left side of most "Select File" dialogs, such as the one that appears when you issue the OPEN command. Unfortunately, I am not always diligent about removing older ones. I have been short on hard drive space on my computer for the last year or so, and have occasionally made DVDs of my personal project folders for older projects and then removed them from my hard drive. This turned any shortcuts to these project folders in AutoCAD into broken links, and waiting for these to time out was what had been causing the delay in opening the "Select File" dialogs. What made the performance on Wednesday exceptionally bad was that the server on which projects started in 2011 were stored went down today, and I had a number of shortcuts to folders on that server. Fortunately, AutoCAD/Windows gives you a clue that the link has become broken, by changing the folder icon from the manila, "3D" folder to a flat, white folder. Thanks to the server issue, I had so many of these white folders that I could not help but notice them. Once I removed all of them, the Select File dialog opening time returned to normal.

December 12, 2013

ACA: Formula Property to Determine if a Block Instance is a Dynamic Block

You can use the following code in an AutoCAD® Architecture Formula Property in a Property Set that applies to Block References to determine if the Block Reference is a Dynamic Block.
set acadApp = GetObject(,"AutoCAD.Application")
set obj = acadApp.ActiveDocument.ObjectIDToObject( [ObjectID] )
RESULT = obj.IsDynamicBlock

As in the previous example, [ObjectID] is a properly created property reference to an automatic property in the same Property Set, named ObjectID, which references the Object ID automatic property source. This formula will return a value of TRUE if the block reference is a Dynamic Block and FALSE if the block is a "regular" block. The property can be used as the condition for an IF Statement, if you need another Formula property to take different actions based on whether or not the block reference is a dynamic block.

December 10, 2013

ACA: Obtaining the Effective Name of a Dynamic Block in a Formula Property

While Dynamic Blocks and ACA do not always play nicely, there are some who want to take advantage of both Dynamic Blocks and the AutoCAD® Architecture Schedule feature. One challenge is that the Name automatic property source may return an anonymous block name rather than the Dynamic Block name; for example, when a Dynamic Block with a stretch action is stretched. Fortunately, you can obtain the orignal block name from the EffectiveName property of the Dynamic Block instance, in a Formula property, using the the following VBScript code:
set acadApp = GetObject(,"AutoCAD.Application")
set obj = acadApp.ActiveDocument.ObjectIDToObject( [ObjectID] )
RESULT = obj.EffectiveName

The Property Set Definition that includes the Formula property will also need to have a property that references the Object ID automatic property source. In the example code above, this property has the default ObjectID name, and the [ObjectID] text in the formula represents a properly created property reference, created by double-clicking the property name in the Insert Property Definitions box in the lower left of the Formula Property Definition dialog.

December 03, 2013

Revit: Hosting Face-Based Light Fixtures to Ceilings in Linked Files

We ran into an issue at the office today, and I wanted to document the solution for my own future reference. Our firm has architects and engineers in-house, and each discipline typically works in separate models that are then linked into each other. This particular project was being done in the 2012 versions of Revit MEP, Revit Structure and Revit Architecture. The electrical engineers found that they were not able to place face-based light fixture families in their model, and host them to the ceilings that were modeled in the linked architectural model. Reflected ceiling plan views were being used and the ceilings were visible, but the fixtures would only host to the Walls.

It turned out that the Ceiling model category was turned off in the affected views in the Electrical model. This did not prevent the linked architectural model from displaying the ceilings, and they were also TAB-selectable in the Electrical model. But it did prevent Revit MEP from "seeing" them as a potential host. Once the ceiling category in the electrical model was turned back on in those views, Revit was able to find the ceilings and host fixtures to them. It was necessary to check the Show categories from all disciplines toggle in order to do this.