March 14, 2019

ACA: Suppress Multiple Objects Contextual Ribbon Tab

Someone in my office today asked if the Multiple Objects contextual ribbon tab could be suppressed. That is the tab that displays when you select items of different object types.
The individual did not want to have to go back to the tab that was previously active where the tool to be used resided. I recalled that some years back, there were controls that would allow you to not have the ribbon focus shift to the contextual ribbon tab (it would activate, but not become the current tab), to have it show on a single-click or to have it show on a double-click. Those choices are no longer available.

What remains is the ability to set the maximum number of objects for which a contextual ribbon will display (RIBBONCONTEXTSELLIM System Variable). The allowable range is 0 to 32767, with an initial default value of 2500. The purpose of this is to limit performance issues when trying to act on a large number of objects. When the number of objects selected exceeds the current value of RIBBONCONTEXTSELLIM, then a contextual ribbon tab will not display, and any ribbon property controls will be disabled (grayed out). Setting the value to 0 allows an unlimited number of objects to be selected and still get a contextual ribbon tab, so this cannot be used to turn off contextual ribbon tabs. But setting it to 1 will allow contextual ribbon tabs to display when just one object is selected (which most would find desirable, particularly for AutoCAD® Architecture and AutoCAD® MEP objects), but disable it when more than one object is selected. This effectively suppresses the display of the Multiple Objects contextual ribbon tab, but does also suppress all other contextual ribbon tabs when multiple objects are selected. For example, if you select two or more Walls, the Wall contextual ribbon tab will not display.

In addition to typing RIBBONCONTEXTSELLIM at the command prompt, pressing the ENTER key and then typing 1 and pressing the ENTER key, you can also set this value in the Options dialog, on the Selection tab, in the Ribbon options area by selecting the Contextual Tab States button and then editing the value in the Object selection maximum for contextual tab display edit box.

This value is stored in the User Settings (registry) for a given AutoCAD Profile, so setting it once will apply to all drawings you open.

I personally leave the setting at the default 2500, but if you often select multiple objects of different types with the intent to select a tool on the ribbon that is not on the Multiple Objects ribbon tab and want to avoid having to perform an extra click to get back to where you previously were in the ribbon, then setting RIBBONCONTEXTSELLIM to 1 may improve your workflow.

February 28, 2019

ACA: Custom Display Block for Door in Plan View

You may have noticed that even after assigning a custom Profile to a Door to add a glazed panel to the Door, that there is no change to the graphics when viewing the Door in "plan" (Top view direction) in any of the out-of-the-box Display Representation Sets, That is because these use one of the "plan" Display Representations for Doors (Plan, Plan High Detail, Plan Low Detail, Plan Screened, Reflected or Reflected Screened), and the Panel component in these is 2D graphics representing the panel width and depth (overall Door width only, in Plan Low Detail) that is not tied to the 3D representation where the glazing is shown.

In my work, I have never needed to indicate glazing in a Door Panel at the typical scales used for plan views (1/16" = 1'-0" to 1/4" = 1'-0"). But if you do have a need for that, you can use a custom display block to add graphics to represent a glazed panel in plan views.

Before we dive into creating the block and assigning it to the Door Style, you need to understand the limitations of custom display blocks in plan Display Representations. The only component to which you can assign a custom display block in plan is the Frame component. You cannot assign one to the Panel component. That means you cannot scale the block by the thickness of the Panel, nor will the block rotate to match the swing angle of the Panel. If you use multiple swing angles for your Panels, you will need multiple display blocks and multiple Door Styles (one of each for each angle). For a 90-degree Panel swing angle (the one we typically use for new construction Doors), scaling the custom display block by the Width, even with the Frame Component set to Inside, will not scale the block along the width of the Panel, but perpendicular to the width of the panel (because ACA thinks it is a Frame component). All of this means that if the graphics in the file need to be accurately shown, and not just a "symbol", you will need a separate custom block and a separate Door Style for each Door width.

If all of that did not change your mind about showing a glazed panel in plan views for Doors, here is how to do it.
  1. Identify the Door Style that is to receive the custom display block. For this example, I have a style called Wood Door with Glazing that has a custom Profile assigned as the Shape on the Design Rules tab of the Door Style. That creates a glazed panel in a model view, but has no effect on the plan view graphics, as seen in the image below.
  2. Verify that the target Display Representation for Doors is active in the current Display Configuration. In this example, the custom display block will be attached to the Plan Display Representation for Doors, and that is active in my current Display Configuation.
  3. Place an instance of the Door in the drawing, and set the Width property of the Door to the width intended for the display block. Having an instance in the drawing is helpful for seeing the effects of the editing so far, and, in cases like this where no scaling will be applied to the block, can be used when generating the linework for the block definition.
  4. Determine where the insertion point of the custom display block will be. In this case, the hinge-side corner of the frame (where it meets the corner of the Door Panel) is an appropriate insertion point.
  5. Draw the linework for the custom display block. If you want to be able to control the display of the linework in the display properties of the Door Style, draw the linework on Layer 0, and assign ByBlock to the Color, Linetype, Plot Style (if using named plot styles), Lineweight and Transparency properties of the linework. In this example, the linework consists of two lines perpendicular to the width of the Door Panel, set in 10" from each end of the Door Panel, and a third line connecting the midpoints of the first two lines, to give a symbolic representation of the glass panel in the Door.
  6. Create the block definition from the linework, being careful to specify the desired insertion point. If you choose to retain the linework or convert the linework to a block, move the linework or block to the side, so that it will not obscure the results of adding the custom block to the Door Style.
  7. Select the Door and, on the Door contextual ribbon tab, on the General panel, select the Edit Style tool. (Or, if you prefer, open the Style Manager, navigate to and select the Door Style in the left pane so that you can edit the style in the right pane.)
  8. Choose the Display Properties tab. The currently active Display Representations will be displayed in bold type. In this example, both the Plan and Threshold Plan Display Representations are active. As the Threshold Plan Display Representation does not allow for attaching custom display blocks, the Plan Display Representation will be used.
  9. Select the Display Representation to receive the custom display block. Left click the toggle in the Style Override column for that Display Representation, to add a display override and open the override for editing.
  10. In the Display Properties dialog, select the Other tab. In the Custom Block Display area, select the Add button.
  11. In the Custom Block dialog, select the Select Block button. Choose the block you created in the Select a Block dialog and select the OK button to return to the Custom Block dialog. The block should show in the viewer.
  12. Back in the Custom Block dialog, change the Insertion Point Y: value to Back and set the Frame Component to Inside. When I did this, the block shifted when I changed the Y setting of the Insertion Point, but did not move when I changed the Frame Component to Inside.
  13. I chose to let the Display setting at Always. If you want to limit the situations where the block will display, select one of the other options: When Intersecting Cut Plane, When Above Cut Plane or When Below Cut Plane, and the block will only display when the selected option is true.
  14. Select OK to ratify the changes, close the Custom Block dialog and return to the Door Style Properties dialog.
  15. If you are a bit leery about the fact that the viewer was showing the custom block outside of the Door Panel, you can select the block name that now shows in the list box in the Custom Block Display area and choose the Edit button. That will reopen the Custom Block dialog and the viewer will properly update and show the block inside the Door Panel, where it belongs. If you are not making any changes, you can select the Cancel button to dismiss the Custom Block dialog; otherwise select the OK button after you are finished with any changes.
  16. In the Display Properties dialog, select the Layer/Color/Linetype tab. Notice that the custom display block now appears as a Display Component. You can make any edits here that you desire. I chose to let the default settings (Layer 0, with ByBlock properties), so that the block will inherit its properties from the parent Door object, just like the Panel, Frame and Swing components. You may want something different. Keep in mind these settings will only be apparent if the linework within the custom display block is on Layer 0 with ByBlock properties, as previously noted.
  17. When you are done editing the properties of the custom display block component, select the OK button to return to the Door Style Properties dialog. Notice that there is now a check mark in the Style Override column and that the Display Property Source now shows Door Style Override - [YOUR DOOR STYLE NAME HERE] rather than Drawing Default. Select the OK button to accept all of the changes to the Door Style and return to the drawing.
    NOTE: If you ever need to edit the display settings for this Door Style's Plan Display Representation, select it and choose the Edit Display Properties button in the upper left of the dialog. Do NOT select the Style Override toggle again; that will clear the toggle and remove the override. If you do that unintentionally, select the Cancel button to exit the dilaog without making any changes, or you will have to recreate the override.
The instance of the Door Style in the drawing should now reflect the addition of the custom display block (assuming that you edited an active Display Representation, as directed above). In the image below, the custom display block instance is at the left and selected, and the Door instance, now showning the custom display block, is at the right.

January 22, 2019

ACA: Unable to execute the tool. Unspecified error.


Had a support request today for the error dialog shown above, from someone working on a file in AutoCAD® Architecture 2016, who was trying to use a Wall Tool when the error occurred. That was all I was initially told, and "Unspecified error" is not terribly helpful. I asked the user to verify what AutoCAD profile was current and whether the problem was just with one file, or all files. In the course of responding, the user provided additional information. The problem was with just this one file, which had been working properly earlier. The reason the Wall Tool was being used was to fix Walls that were now "faulty." And when opening the file, this other dialog appears:


Bingo! The file had been opened and saved in AutoCAD Architecture 2018. Most likely, SAVEAS was used to set the file format to the 2013 file format, but that left the AEC objects in the file, including the Walls, in the 2018 file format. Those future objects disabled the AEC Commands, leaving the Wall Tool with no command to run. Add that to the list of reasons for getting an Unable to Execute The Tool error dialog.

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.