January 14, 2019

ACA: Accessing AEC Data in Formula Properties for Multiple Versions

Some "advanced" formula properties (see this blog post for an example) that pull in AEC Data not available in the automatic properties have to reference one of the AEC modules, and need to include the first two version numbers for the current version of AutoCAD® Architecture or AutoCAD® MEP that is running. The version numbers can be obtained by running the AECVERSION command in a given version. For example, AecX.AecBaseApplication.8.1 is the Aec Base Application module for the 2019 version.

If you want a formula property to work across multiple versions, it has to know what version is running to be able to call the correct application version. For a small number of versions, that can be built into the formula property without too much difficulty or confusion (see previously linked example). But I recently had a reason to revisit a formula that retrieved the elevation of a ceiling object (based on the Wall elevation formula in the example blog post), and, over ten years later, there are more than a small number of versions that could be supported. In this case, I decided that it made more sense to pull out the code to determine the AECVERSION numbers into a separate formula property. This would be particularly effective if multiple formula properties needed to access it. Taking it one step farther, the following code will give you just the numeric suffix, which the primary formula property could then concatenate with the name of the Aec Application being referenced. Versions 2008 through 2019 are supported by this code.
Set acadApp = GetObject(,"AutoCAD.Application")

'ACADVER values:
'ACD-A2008 = "17.1s (LMS Tech)"
'ACD-A2009 = "17.2s (LMS Tech)"
'ACD-A2010 = "18.0s (LMS Tech)"
'ACD-A2011 = "18.1s (LMS Tech)"
'ACD-A2012 = "18.2s (LMS Tech)"
'ACD-A2013 = "19.0s (LMS Tech)"
'ACD-A2014 = "19.1s (LMS Tech)"
'ACD-A2015 = "20.0s (LMS Tech)"
'ACD-A2016 = "20.1s (LMS Tech)"
'ACD-A2017 = "21.0s (LMS Tech)"
'ACD-A2018 = "22.0s (LMS Tech)"
'ACD-A2019 = "23.0s (LMS Tech)"

acadVerString = acadApp.ActiveDocument.GetVariable("ACADVER")

'Set ACD-A application string, based on version running:
Select Case acadVerString
 Case "17.1s (LMS Tech)"
  RESULT = ".5.5"
 Case "17.2s (LMS Tech)"
  RESULT = ".5.7"
 Case "18.0s (LMS Tech)"
  RESULT = ".6.0"
 Case "18.1s (LMS Tech)"
  RESULT = ".6.5"
 Case "18.2s (LMS Tech)"
  RESULT = ".6.7"
 Case "19.0s (LMS Tech)"
  RESULT = ".7.0"
 Case "19.1s (LMS Tech)"
  RESULT = ".7.5"
 Case "20.0s (LMS Tech)"
  RESULT = ".7.7"
 Case "20.1s (LMS Tech)"
  RESULT = ".7.8"
 Case "21.0s (LMS Tech)"
  RESULT = ".7.9"
 Case "22.0s (LMS Tech)"
  RESULT = ".8.0"
 Case "23.0s (LMS Tech)"
  RESULT = ".8.1"
 Case Else
  RESULT = "Unknown"
End Select

Note that any line beginning with a single quote is a comment, and is ignored when the VBScript code is evaluated. The ACADVER values shown in the initial comments could be removed; I like to keep them for easy reference, as I tend to forget the ACADVER value for any given release.

January 12, 2019

Dynamo: Getting a List of All Label Types

We have a client with specific font standards in AutoCAD® that I suspect will carry over into Revit®. These differ from our office standards, so I was looking for a way to more easily change the fonts used for various text entities in a project file started with our template file or loadable families, and hoping to use Dynamo as part of the solution.

In a project file, getting all of the TextNoteTypes (for Text) is fairly straightforward. Start with an Element Types node set to "TextNoteType" and feed it to an All Elements of Type node. In a family file where Labels are present, getting a list of TextElementTypes is a little more complicated, if you do not want them mixed in with TextNoteTypes, as setting the Element Types node to "TextElementType" and feeding the output to an All Elements of Type node will return both types. A List.FilterByBoolMask node can be used to separate the two types, if your application needs to operate on just one or the other type (or both, but separately). The image below illustrates one possible arrangement, where the in ouput will have a list of the TextElementTypes (Labels) will and the out output will have a list of the TextNoteTypes (Text).
The List.FilterByBoolMask node in the green area is the node with the separated lists. The other List.FilterByBoolMask node in the upper right is there just to show the Family Name parameter value of each Type, to verify that the mask worked as desired, and can be deleted.

December 19, 2018

Revit 2018: Disabling Addins to Resolve Cloud Render Issue

If you ever have an issue with Revit being unable to upload a model for a cloud rendering, you will likely end up on this Autodesk Knowledge Network article, and may eventually get to the suggestion to disable the addins to see if there is a conflict with one of them, which links through to a second Autodesk Knowledge Network article.

The second article helpfully lists a number of addins that should be left in place if you are using the Collaboration for Revit service. What it does not list is the addin that generates the Render in Cloud tool on the View ribbon tab, on the Presentation panel. It is rather hard to test whether removing the addins allows a cloud render to go through if the tool to initiate a cloud render is gone.

I was able to work out that the RaaSForRevit folder should not be removed from the W:\ProgramFiles\Autodesk\Revit 2018\AddIns folder if you want to have the Render in Cloud tool.

December 18, 2018

No More 32-bit AutoCAD

See this Autodesk Knowledge Network Article for details on the discontinuation of a 32-bit version of AutoCAD, starting with the next release.

December 09, 2018

Dynamo: Export Views and Sheets from Revit - Part 6

First post in this series [Part 1]
Previous post in this series [Part 5]

We now have all of the user input needed to create the export, and we have taken the user-specified ViewSheetSet and generated a list of the View and Sheet objects included in the ViewSheetSet and a corresponding list of names to be used for the exported Views and Sheets. All that remains is to do the actual export. The Python Script 2 node in the Export to DWG group does the export.
There are six inputs to this node:
  • IN[0]: This input takes the folder the user specified as the destination for the exported drawing files (see Part 1).
  • IN[1]: The recombined list of Views and Sheets is sent to this input (see Parts 2 and 3).
  • IN[2]: This input receives the list of generated file names for the exported Views and Sheets (see Part 4).
  • IN[3]: The name of the DWG Export Setup to be used is sent to this input (see Part 5).
  • IN[4]: The user choice of whether to merge the Views on a Sheet into one drawing file (true) or not (false) is received by this input (see Part 5).
  • IN[5]: The user choice of whether to actually export the Views/Sheets (true) or to just run the graph without exporting (false) is sent to this input (see Part 5).

The image below shows the Python code that processes this input. The majority of this code was written by Konrad K Sobon, and posted to this thread in the DynamoBIM forum. It also includes the ability to have exported Sheets to have the Views on the Sheet merged into the View drawing file, rather than exported as separate drawing files that are then externally referenced by the Sheet drawing file. This addition was posted to the DynamoBIM forum by 4bimfercesp in this thread. The ability to specify the name of an existing DWG Export Setup comes from code posted by Andrea_Ghensi in the same thread in which Mr. Sobon posted his code. As I read through the postings and assembled the code shown below, I added some additional comments to solidify my understanding of what the code is doing.

If there are no errors generated in the course of performing the requested export, the Python Script 2 node outputs a string, Success!. This is displayed in the Watch node to the right of the Python Script 2 node. If there is at least one error, then the error report is the output, and is displayed in Watch node to aid in sorting out what went wrong. If the user input in the Group 5 area is false, indicating that the export is not to be done, then the output is a reminder to set the Ready to Export Views and/or Sheets - Boolean node to true to perform an export.

If you need to export the same Views and/or Sheets multiple times as a project makes its way through the design and documentation process, this graph can be a time saver while improving consistency. Customize a copy of it for each project, and use Dynamo Player to be a few clicks away from a new set of export files at any given moment.

December 06, 2018

ACA: Multi-View Blocks and DRAWORDER

A reminder for those who already know about this, and a heads up for those who do not. Multi-View Blocks do not respect any dipslay order modifications made to the nested objects in the AutoCAD block assigned as a view block to the Multi-View Block. So if you use the DRAWORDER command to get things to look the way you want in the AutoCAD block, those changes will not show up when that block is assigned to a Multi-View Block Definition and an instance of that definition is placed in your drawing file.

For example, suppose you have a custom Space Tag that includes a an overall rectangle with a dividing line that separates the Space name from the Space number, as illustrated in the image below.
Further suppose that you often place these tags in areas where there is linework "below" the tag, and you would rather not have that show inside the outer rectangle, so that the name and number can be more easily read. You might decide to add a Wipeout to the view block to accomplish this task. So you place an instance of the view block, edit it in place (or in the Block Editor) and use the WIPEOUT command to add a Wipeout to the Block Definition, using the outer rectangle, which just happens to be a closed Polyline, to do so (without erasing the Polyline). So far, so good. Before saving the changes to the Block Definition, you select the Wipeout, right click and choose Basic Modify Tools > Display Order > Send to Back from the context menu, to execute the DRAWORDER command and send the Wipeout to the back of the draw order. After saving the changes back to the Block Definition (and closing the Block Editor, if you used it), you see that the instance of the view block is working as desired - the Wipeout is hiding linework under the view block instance, while showing all of the other linework in the block definition.

But when you examine your Space Tags, you find that while the tags now hide linework "below" them, the line between the room name and room number is no longer visible. If you select a Space Tag, that line is highlighted, so you know it was not accidentally erased or otherwise removed from the Block Definition, but it does not show. (Attributes seem to be treated differently from other linework, and do still appear on top.) What gives? Multi-View Block instances do not respect changes in draw order, and display the items within the view block definition in the order in which they were added to the Block Definition.

What to do? Do not use the DRAWORDER command to put things in the desired order - draw them in that order. You do not have to recreate the Block Definition for the view block from scratch. You can proceed as mentioned earlier, but after creating the Wipeout, instead of using DRAWORDER to push the Wipeout to the back, select all of the objects other than the Wipeout and use the COPY command, with a Displacement of 0,0, to create a new copy of each item in the same place. Then use the ERASE command, with the Previous command line option, to erase the objects you just copied. Now the Wipeout is the first item drawn in the Block Definition, and you can save the changes and have the desired draw order respected in both the view block and the Multi-View Block.

In the image below, the same Spaces and Tags from the first image are shown. The Space Tags, while appearing identical, are actually instances of two different Multi-View Block Definitions, each with its own view block. The view blocks just happened to have equivalent contents. The Space Tag in Space 101 had a Wipeout added to the view block, pushed to the back using the DRAWORDER command. The Space Tag in Space 102 had a Wipeout added to the view block, and then the other items in the Block Definition were copied in place, and the originals erased. The line between the room name and number is hidden by the Wipeout in 101, but is seen in 102.

November 29, 2018

Dynamo: Export Views and Sheets from Revit - Part 5

First post in this Series [Part 1]
Previous post in this series [Part 4]

So far in this series, we have seen nodes that allow the user to specify a folder to receive exported drawing files, a node for the user to enter the name of a ViewSheetSet which lists the Views/Sheets to be exported, the nodes that generate a list of Views/Sheets that are in that Set, nodes to separate that list into separate lists of just Views and just Sheets, and the nodes that generate file names to be used for the exported Views and Sheets. This post will examine the balance of the user input nodes.


Each of these three input nodes includes a second "Passthrough Value" node, which are renamed Code Blocks and, as the node title suggests, simply pass through the value from the input node. They are not at all necessary, and are only there to make the group each is in wider, so that the rather long group titles will only take up two lines of text.

The Name of DWG Export Setup - String node (Group 3) is a String node into which the user enters the name of the DWG Export Setup to be used for the exports. This can be left blank if the user wants to use Revit Default settings.

The Merge Views on Sheet into one DWG File? - Boolean node (Group 4) is a Boolean node that allows the user to choose whether Views on a Sheet should be exported as one DWG file (True) or if the Views should be exported as separate DWG files that are externally referenced into the exported Sheet (False).

The Ready to Export Views and/or Sheets - Boolean node (Group 5) is a Boolean node. Setting this to False allows the user to enter data in the other nodes and Run the graph to view the results in the Watch nodes, verifying that all is correct before actually exporting any files. When all is ready to go, set this to True and run the graph one more time to export the Views/Sheets.

All three of these input nodes, like the other two, are set to be input nodes (see first post), so that they are available if this graph is run via Dynamo Player. The next and final post will examine the Python Script 2 node and the code inside it, that does the actual exporting.

October 28, 2018

ACA: Custom Profile for Railing Plan Display Representations

As noted in a previous post about Custom Blocks for Railings, those blocks can only be attached to the Model Display Representation. While the Plan, Plan High Detail, Plan Low Detail and Plan Screened Display Representations do not allow for Custom Blocks, they do allow for Custom Profiles, which may work for showing a base plate at each post, depending upon how fussy you are about the graphics. One might first ask the question, "Do I really need to see base plates in a plan view of a Railing?" At typical plan scales (1:100, 1/8" = 1'-0", 1:50, 1/4" = 1'-0"), one could make a convincing argument that the added graphic will, at best, be a slightly wider blob, with the lineweights causing the plotted linework to merge with the railing and post graphics. For the purposes of this example, lets say that for the High Detail Display Configuration/Plan High Detail Display Representation Set (Top view direction)/Plan High Detail Display Representation for Railings, we do want to show the base plates. This can be done by adding a Custom Profile to the post components.

Before we can add a Custom Profile, we have to define the Profile. To do so, I drew a closed Polyline to show the 5.5" x 2" top view rectangle of the base plate that was created in the previous article, as shown in the image below, taken from a SW Isometric view. The Color 140 diagonal line is a Line on layer G-Anno-Nplt and will not be part of the profile, but is there to make it easy to specify the insertion point of the Profile, by snapping to the midpoint of the Line.

Create a Profile from this Polyline by doing the following:
  • Select the Polyline, and right click. Choose Convert To > Profile Definition from the context menu.
  • At the Insertion point or [Add ring Centroid] command line prompt, select the midpoint of the diagonal Line, using the Midpoint object snap.
  • In the New Profile Definition dialog, enter a name for the Profile, in the New Name edit box. I chose to call the Profile in this example RailingPostBasePlate. Select the OK button.

The Profile for the base plate is now available. If you want, you can open the Style Manager and take a look at it, under Multi-Purpose Objects > Profiles. If you do take a look, close the Style Manager without making any changes.

The newly created Profile can now be added as a Custom Profile to the Posts in the Railing.
  • Edit the Railing Style.
  • On the Display Properties tab, select the Plan High Detail Display Representation. Depending upon what view direction and Display Configuration are current, this may or may not be the Display Representation in bold type.
  • Left click on the toggle in the Style Override column on the Plan High Detail Display Representation line to create a style-level override and open the Display Properties dialog for the overridden Plan High Detail Display Representation.
  • In the Display Properties dialog, select the Other tab.
  • Select the Add button. This will open the Custom Profile dialog.
  • In the Custom Block dialog, select the Select Profile button, and then choose the Profile Definition for the base plate in the Select a Profile dialog.
  • Select OK to ratify the choice of Profile and return to the Custom Profile dialog.
  • Since we want this added to the Posts, in the Component area at the upper right, clear the check mark from the Baluster toggle and add one to both the Fixed Post and Dynamic Post toggles. We only want to add this block to the existing posts, not replace the posts, so leave the Replace toggle unchecked.
  • Verify that none of the toggles in the Scale To Fit or Mirror In areas are checked.
  • Verify that the Insertion Point is set to Center for X and Y. This matches the insertion point of the RailingPostBasePlate Profile that was created.
  • Verify that the Insertion Offset values are all set to 0.
  • Choose an appropriate radio button in the Attach To area. Since I wanted all posts to have the base plate, I chose All in this example.
  • Select OK to ratify the Custom Profile settings, dismiss the Custom Profile dialog and return to the Display Settings dialog.
  • Select the Layer/Color/Linetype tab.
  • Notice that, unlike with Custom Blocks, there is not a new Display Component listed for the Custom Profile. Based on some experimentation with the Color property, it does not appear that the Custom Profile is associated with any of the Display Components shown, either, but behaves as if ByBlock were selected for each property.
  • Select the OK button twice, to accept all the edits made, dismiss the Display Properties and Railing Styles dialogs (or, if you edited the Railing Style with the Style Manager, to dismiss the Display Properties dialog and the Style Manager) and return to the drawing.
In a Top view with a Display Configuration with the Plan High Detail Display Representation for Railings active, the added Custom Profile will be seen at the posts. So far as I know, it is not possible to have any rails that cross over the Custom Profiles hide the Custom Profile linework that passes "under" the rail. Most likely because the rail is just two lines in this Display Representation, not a solid object, and ACA has no way of knowing that the Custom Profile represents a base plate down at the bottom of the post.

Given the lack of display control and the resulting graphics, I doubt that I would use a Custom Profile to represent a railing base plate; certainly not one of this size relative to the size of the railing. I would probably only show this in a detail, with independent linework, rather than as part of the model. One other interesting effect to keep in mind should you decide to go this route, if you add a Custom Profile to all of the posts in a Railing that is anchored to a Stair object, the Custom Profile will display for each post, even those that are not drawn in the view because they are above the cut plane of the Stair. Checking the Replace toggle in the properties of the Custom Profile, so that the Profile replaces the graphics of the posts does not affect the display behavior here. The posts will not be drawn, but all of the base plates will show at the Stair, and they will display with ByBlock display properties, not the display properties assigned to any of the post components.

October 24, 2018

ACA: Custom Block for Railing Model Display Representation

The Model Display Representation of Railings in AutoCAD® Architecture allow for the addition of custom blocks to create additional display components for the Railing. For example, you can add base plates to the Railing Posts. For this example, I started with the out-of-the-box Guardrail - Pipe Railing Style and renamed it to Guardrail - Pipe with Base Plate.

The first step is to create an AutoCAD Block Definition to represent the base plate. I decided that the base plate should be 5.5" long, 2" wide and 1/4" high, and I wanted to be able to use the same Material Definition that is used for the Railing, so I chose to use a Mass Element for the base plate, and created a Mass Element Style, called Stainless Steel, that had the same Material Definition assigned. In the example file, which can be found in this AutoCAD Architecture forum post, I used the out-of-the-box Metals.Metal Handrails and Railings.Stainless Steel.Satin Material Definition. Using the Stainless Steel Mass Element Style, I created a "Box" shaped Mass Element of the desired dimensions.

I then made a Block Definition with the Mass Element as the only included object, with the insertion point at the centroid of the bottom face of the Mass Element.


With the Block Definition created, the next step is to add it to the Railing. This is done in the Railing's Display Properties, in the Model Display Representation. Because I want this block to be added to all instances of this Railing Style, but do not want it to be added to all Railings, this was done as a Style-level Display Override.
  • Edit the Railing Style.
  • On the Display Properties tab, select the Model Display Representation. Depending upon what view direction and Display Configuration are current, this may or may not be the Display Representation in bold type.
  • Left click on the toggle in the Style Override column on the Model Display Representation line to create a style-level override and open the Display Properties dialog for the overridden Model Display Representation.
  • In the Display Properties dialog, select the Other tab.
  • Select the Add button. This will open the Custom Block dialog.
  • In the Custom Block dialog, select the Select Block button, and then choose the Block Definition that contains the base plate in the Select a Block dialog.
  • Select OK to ratify the choice of block and return to the Custom Block dialog.
  • Since we want this added to the Posts, in the Component area at the upper right, clear the check mark from the Baluster toggle and add one to both the Fixed Post and Dynamic Post toggles. We only want to add this block to the existing posts, not replace the posts, so leave the Replace toggle unchecked.
  • Verify that none of the toggles in the Scale To Fit, Mirror In or Rotate areas are checked.
  • Verify that the Insertion Point is set to Center for X and Y and Bottom for Z. This matches the insertion point of the RailingPostBasePlate block that was created.
  • Verify that the Insertion Offset values are all set to 0.
  • Choose an appropriate radio button in the Attach To area. Since I wanted all posts to have the base plate, I chose All in this example.
  • Select OK to ratify the Custom Block settings, dismiss the Custom Block dialog and return to the Display Settings dialog.
  • Select the Layer/Color/Linetype tab.
  • Notice that there is a new Display Component listed, with the same name as the name of the Block Definition selected for the Custom Block. You can make any desired settings here, but since a Mass Element is the only element in the Custom Block, it will follow its own display settings for the Model Display Representation. The out-of-the-box drawing default settings display Mass Elements "By Material" for the Model Display Representation, just like all of the other Railing components. Since the same Material Defintion is assigned to the Railing components and the Mass Element in the Custom Block, they should all display alike. (If you really wanted to control the display properties of the Custom Block on the Layer/Color/Linetype tab of the Railing Display Properties, you could set a Style-level display override on the Mass Element Style for the Model Display Representation, clear the ByMaterial toggle and set all of the properties in the Mass Element Style Override to ByBlock. But that is not the goal in this example, and beyond the scope of this article.)
  • Select the OK button twice, to accept all the edits made, dismiss the Display Properties and Railing Styles dialogs (or, if you edited the Railing Style with the Style Manager, to dismiss the Display Properties dialog and the Style Manager) and return to the drawing.
If you do not already have an instance of the Railing Style in your drawing, add one, and then change to one of the isometric view directions, if you are not in one already. You should see the Custom Block at the bottom of each post.
The baseplate will show whenever the Model Display Representation for Railings is active, which is just about any Display Configuration/View Direction combination where Railings are turned on, except for the Top view direction, where one of the "plan" Display Representations will be used. The Plan Display Representations do not allow for attaching Custom Blocks, but they do allow for adding Custom Profile Displays. An article on how to do that can be found here.

October 15, 2018

Dynamo: Export Views and Sheets from Revit - Part 4

First post in this series [Part 1]
Previous post in this series [Part 3]

This post describes the nodes that generate the file names for the exported drawing files. As you may recall from the previous posts in this series, a list of Views and Sheets was generated from a user-created ViewSheetSet in Revit® by a Python Script node. That list was then separated into two lists, one for Views and one for Sheets, to allow for separate naming conventions for the exported drawing files for each. (Specifically, so that the sheet number can be included in the file name for Sheets.) The nodes that do this are contained in three groups: Generate Names for Exported Views, Generate Names for Exported Sheets and Combine Names....
All three groups make use of out-of-the-box nodes. The first two groups are nearly identical, and can be described simultaneously. The first node in each of those groups is a Code Block node, renamed to Exported DWG File Name Format for Views for the exported Views and Exported DWG File Name Format for Sheets for the exported Sheets. Each of these nodes has one input, view which takes the respective list from the List.FilterByBoolMask node covered in Part 3. A combination of parameter values associated with each View/Sheet and text is used to create the file name for each View/Sheet:
  • For Views: dwgname = view.Name + "_Export" + ".dwg";
  • For Sheets: dwgname = view.SheetNumber + "_" + view.Name + "_Export" + ".dwg";
The drawing name for Views concatenates the view.Name parameter value with "_Export" and the ".dwg" file extension. The drawing name for Sheets is similar, but adds the view.SheetNumber parameter values at the beginning, separating the sheet number from the sheet name with an underscore ("_") character. This is what I set up as a default for use in my office; you can customize this to meet your needs by adding, removing or rearranging the parts.

The lists of Sheet and View names are then run through two String.Replace nodes. The first replaces any asterisks ("*") with underscores ("_") and the second replaces any forward slashes ("/") with hyphens ("-"), as neither of these characters are permitted in a drawing file name, even though they are allowed in a View or Sheet name in Revit. Each resulting list of file names is then passed through a Watch node, so that the contents can be inspected after the graph is run. These two lists are then sent to the Combine Name... group, where a List.Create node and a Flatten node combine them into a single list. An optional Watch node is included here, as well.

So now we have a combined list of View and Sheet objects (from Part 3) and a combined list of file names for the corresponding exported files. The next post will look at the remaining user input nodes.

Next post in this series [Part 5]