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.

November 30, 2013

ACA: Offset External References, Location Properties and Schedule Tags

If you have ever externally referenced several files into one host file, and had Schedule Tags placed within the externally referenced files that displayed property values that were from or based on Location properties, you may have found that in the host file, the Schedule Tags did not display the expected values. One common example would be the use of a Door Tag that displays an ID value for the Door that is based in part on the associated room number, with the room number value being brought into the Door's properties via a Location property.

Depending upon what version you are using and how you place the external references, you may find that the values displayed in the tags all display values from the Spaces of one of the external references, or that you get *Space not found* in lieu of the Space-based property value that the Location property is supposed to be reading and which shows as expected when the externally referenced file is opened directly.

Things worked as expected in ACA 2009 and earlier, but some change made in the 2010 release affected the way that Location-property-dependent values are displayed in tags nested (placed) in the files that are externally referenced. All of the examples shown in this article are done outside of the Drawing Management feature (Project Browser and Project Navigator). Because managing property data overrides is difficult outside of the Drawing Management feature, tags referencing object-based properties are usually placed directly in the file that holds the object being tagged. (My firm does it this way, and from recent posts in the Discussion Groups, it appears that others do as well.) Note also that a Schedule Table placed in the host file that is set to scan external references and which uses the external references for the selection set and applies to the same objects that are tagged by the nested Schedule Tags will display the expected values in all of the releases from 2010 through 2014; the issue is only with the values displayed by nested Schedule Tags. In all releases since 2010, it appears that nested Schedule Tags do not look for a Space from the effective location of the nested Location grip in the host file, but instead take the relative X- and Y-distances from the insertion point of the external reference to the Location grip, and then apply that X, Y coordinate relative to 0,0 in the host file and look there for a Space (or, if your Location references a property attached to an AEC Polygon, for an AEC Polygon). If it finds a Space, it reads the specified property from that Space. That works fine for one external reference, inserted at 0,0. But in a file where you are inserting several external references, you will likely not place all of the files at 0,0,0, since then it would be up to ACA to determine which of what would likely be several overlapping Spaces would be used. Assuming that each floor of the floors is above or below the others (and that they share a common 0,0 point), all of the floors would be reading values from the Spaces in the floor placed at 0,0,0.

The logical solution would be to not place any of the external references in the host file at 0,0,0 and to place then such that the building footprint relative to 0,0,0 is left open in the host file. Unfortunately, in the 2010 and 2011 releases, that results in the tags displaying *Space not found* in lieu of the expected Space-based property value. I apologize to anyone still using the 2012 release, as I do not have access to an installed version of that release, so I am not certain how that release behaves. In the 2013 and 2014 releases, a partial adjustment was made, and the tags will display the value they display directly in the external reference file, provided that there is no Space at the "mapped" location relative to 0,0 in the host file.

I have posted some sample files, in the Door tag incorrectl​y finding informatio​n from other floors thread in the Autodesk AutoCAD® Architecture General Discussion Group, based on the "Room" shown in the image above, so that you can see the effects firsthand. There are three "floor" files, for the First, Second and Third floors, and a "sheet" file into which the three floor files are externally referenced. Each floor file has a single Space onto which two doors open. The files include a modified version of out-of-the-box DoorObjects Property Set Definition, in which two new properties have been added: RoomNumberNonProjectBased is a Location property, referencing the SpaceObjects:Number property attached to the Space; NumberRoomBased is a Formula property that concatenates the RoomNumberNonProjectBased property, a period (".") and the NumberSuffix property. The left-side doors have a NumberSuffix value of "1"; the right-side doors have a value of "2". The sheet file has a modified version of the out-of-the-box Door Schedule, with the MARK column deleted and replaced by a DOOR ID column, displaying the value of the NumberRoomBased property. The Doors are tagged in each floor file with a custom Schedule Tag that also references the NumberRoomBased property. The files were created in ACA 2010, so that they can be opened in that release or any later release.

The image below is of the sheet file, opened in 2010. None of the externally referenced floor files is inserted at 0,0, and there are no Spaces below the "mapped" location of the Location grips of the Doors.
Notice that the DOOR ID column in the schedule table correctly shows the values on all three floors, yet, as shown in the enlargement of the Second Floor external reference, the Schedule Tags inside the plan external references, which tag the doors, show *SPACE NOT FOUND* instead of the room number.

If the First Floor external reference is moved so that its insertion point is at 0,0,0 and the model is regenerated, then the nested Schedule Tags on the Doors on all three external references read the room number from the First Floor external reference. The Schedule Table continues to show the correct values, as seen in the image below.

If the First Floor external reference is moved back to its previous location, away from 0,0,0, and two Spaces (ROOM 5555 and ROOM 6666) are drawn in the host file, one at each mapped location and the model is regenerated, then the nested Schedule Tags on the Doors on all three external references will read the corresponding room numbers (5555 and 6666), but the Schedule Table will show the correct values, as shown in the image below.

Opening the same files in 2013 or 2014 will give the same results, with the exception of the first sheet view image above, where instead of *SPACE NOT FOUND*, the desired room numbers will be displayed on all three floor plans, because there is no Space in the "mapped" location.

November 27, 2013