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 incorrectly finding information 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 30, 2013
November 27, 2013
Revit: Guide Grids
Paul Aubin has a helpful tip on the use of Guide Grids in Revit. Read the post and watch the detailed explanatory video in his blog post.
November 18, 2013
Help! If only....
This is just a quick vent post on my increasing frustration with the Help that is currently available in AutoCAD® Architecture. I appreciate that moving the online Help "online" (internet-based) allows them to update the content, and that the vehicle for doing so would not necessarily be the same as it was back in the 2010 release, when the "online Help" files were locally installed. But it seems with each release, they take away another feature and make it that much harder to actually use the Help.
My personal peeve is the removal of the Contents tab. The old search function may not have always gotten me to the page I wanted, but more often than not it got me close, and I could then pop over to the Contents tab and look in the general vicinity of the "close" page and usually find what I needed. In its current incarnation, the Help is all but totally dependent upon the Search feature, as the only other options are a few general links on the home page (thank goodness they put a link to the system variables back on that page) and the Favorites, where you can save a page once you finally find it. If the new search was all that and then some, perhaps I would not be so frustrated. Here is an example of why I am frustrated:
I was trying to get up to speed on object transparency, and I had become aware that when plotting, transparency is turned off, by default, for performance reasons. I could see the toggle to enable transparency in the plot dialog, but I wanted to know more about it, and whether there was a System Variable that could also control that setting. So I did a search for PLOT TRANSPARENCY filtered for User information, and the second hit was the Plot Dialog Box article in the Help, which I selected and scrolled down to the section on Plot Options, which had the description of the Plot Transparency toggle.
As I suspected, there was a System Variable, and I wanted to know more about it. Unfortunately, the PLOTTRANSPARENCYOVERRIDE text in the Help was not a hyperlink. "No problem," I thought, "my current search is for PLOT TRANSPARENCY, surely PLOTTRANSPARENCYOVERRIDE must be in the search results." So I scrolled down the first page of results and did not find it. I went to the second and third pages and came up empty there, too. (For the record, it was there, the twentieth item on page five. I typed two thirds of the title of that article as my search criteria. How could it possibly be the 120th result?)
After scrolling through the third page, I grew weary and decided to take advantage of the fact that I already knew the name of the System Variable. Perhaps the problem was that I had typed a space between "PLOT" and "TRANSPARENCY". I removed that space and redid the search, only to find that PLOTTRANSPARENCY generated no results.
The Help did kindly offer an alternate search term, which I gamely tried (even though it introduced extraneous text). I was very disappointed to find that there were no search results for plottransparenz, either. Why offer an alternate search term if there are no results for it?
Finally, I did what I apparently should have done before even looking through the current search results, and changed the search string to PLOTTRANSPARENCYOVERRIDE. Searching on the entire name resulted in a much-reduced list of hits and put the one I wanted right at the top. All well and fine, since I already knew the name of the System Variable, but what about times when I half-remember part of the name? Why is the search limited to whole words?
After the fact, I did discover one somewhat hidden gem in the current Help. If you select the tool with the funnel icon to the right of the user type drop down, you have the opportunity to filter the search results to just Commands, just System Variables or just Commands and System Variables. Had I done this on my original search terms of PLOT TRANSPARENCY, the article I wanted would have been the first search result and I would have been somewhat less frustrated. The filter does not resolve the issue where partial System Variable or Command names do not generate any results (unless that part exists as a free-standing "word" somewhere in the text). But it will save me from having to scroll through five pages of results to find something that should have been on page one from the start.
Note that unchecking the "Include Autodesk Web Results" toggle only removed four items from my original search, and the PLOTTRANSPARENCYOVERRIDE page was still on the fifth search results page, moving all the way up to number 118.
My personal peeve is the removal of the Contents tab. The old search function may not have always gotten me to the page I wanted, but more often than not it got me close, and I could then pop over to the Contents tab and look in the general vicinity of the "close" page and usually find what I needed. In its current incarnation, the Help is all but totally dependent upon the Search feature, as the only other options are a few general links on the home page (thank goodness they put a link to the system variables back on that page) and the Favorites, where you can save a page once you finally find it. If the new search was all that and then some, perhaps I would not be so frustrated. Here is an example of why I am frustrated:
I was trying to get up to speed on object transparency, and I had become aware that when plotting, transparency is turned off, by default, for performance reasons. I could see the toggle to enable transparency in the plot dialog, but I wanted to know more about it, and whether there was a System Variable that could also control that setting. So I did a search for PLOT TRANSPARENCY filtered for User information, and the second hit was the Plot Dialog Box article in the Help, which I selected and scrolled down to the section on Plot Options, which had the description of the Plot Transparency toggle.
As I suspected, there was a System Variable, and I wanted to know more about it. Unfortunately, the PLOTTRANSPARENCYOVERRIDE text in the Help was not a hyperlink. "No problem," I thought, "my current search is for PLOT TRANSPARENCY, surely PLOTTRANSPARENCYOVERRIDE must be in the search results." So I scrolled down the first page of results and did not find it. I went to the second and third pages and came up empty there, too. (For the record, it was there, the twentieth item on page five. I typed two thirds of the title of that article as my search criteria. How could it possibly be the 120th result?)
After scrolling through the third page, I grew weary and decided to take advantage of the fact that I already knew the name of the System Variable. Perhaps the problem was that I had typed a space between "PLOT" and "TRANSPARENCY". I removed that space and redid the search, only to find that PLOTTRANSPARENCY generated no results.
The Help did kindly offer an alternate search term, which I gamely tried (even though it introduced extraneous text). I was very disappointed to find that there were no search results for plottransparenz, either. Why offer an alternate search term if there are no results for it?
Finally, I did what I apparently should have done before even looking through the current search results, and changed the search string to PLOTTRANSPARENCYOVERRIDE. Searching on the entire name resulted in a much-reduced list of hits and put the one I wanted right at the top. All well and fine, since I already knew the name of the System Variable, but what about times when I half-remember part of the name? Why is the search limited to whole words?
After the fact, I did discover one somewhat hidden gem in the current Help. If you select the tool with the funnel icon to the right of the user type drop down, you have the opportunity to filter the search results to just Commands, just System Variables or just Commands and System Variables. Had I done this on my original search terms of PLOT TRANSPARENCY, the article I wanted would have been the first search result and I would have been somewhat less frustrated. The filter does not resolve the issue where partial System Variable or Command names do not generate any results (unless that part exists as a free-standing "word" somewhere in the text). But it will save me from having to scroll through five pages of results to find something that should have been on page one from the start.
Note that unchecking the "Include Autodesk Web Results" toggle only removed four items from my original search, and the PLOTTRANSPARENCYOVERRIDE page was still on the fifth search results page, moving all the way up to number 118.
October 19, 2013
ACA: AEC Content on the Ribbon
In December of 2009, I contributed an article to AU Tech Talk, about adding tools for AEC Content to the ribbon in AutoCAD® Architecture. That article no longer appears to be available on the Autodesk website, so I am reposting it here:
The out-of-the-box AutoCAD Architecture ribbon tabs include a number of tools that allow you to add AEC content such as elevation and section marks, keynotes, leaders, display themes, schedule tags and schedule tables. Rather than duplicate the abilities of tool palette tools to import styles or definitions from a source file when necessary and to preset property values, these ribbon tools “run” a tool palette tool, through the AECRIBBONTOOL command.
To create a ribbon tool for your own custom content, you will need a tool palette tool for the content and an editable customization file in which you can add a ribbon tool.
Tool Palette Tool
Any tool palette tool that exists in the current workspace can be referenced from a ribbon tool, whether or not the palette on which the tool resides is included in the current tool palette group. If the ribbon tool is to be shared with others, everyone will need to have the referenced tool and you will not want the tool or the palette on which it resides to be easily deleted or edited. The out-of-the-box setup achieves this by having the ribbon tools reference tools that are on a read-only palette that is not part of any of the out-of-the-box tool palette groups. To see this palette, you need to set “All Palettes” current. Depending on what profile is set current, this palette may be called Ribbon Tools – AutoCAD Architecture (US Imperial), Ribbon Tools – AutoCAD Architecture (US Metric), Ribbon Tools – AutoCAD Architecture (UK) or a palette associated with the localized content your are using. You may want to set up a similar read-only palette for the tools that will be referenced by your ribbon tools, if you do not have a read-only, network-based tool palette location that everyone has in their workspace.
Figure 1 – Custom Ribbon Tools palette with tools to be added to the ribbon.
Customization File
Ribbon tools are created in a CUIx file by placing commands on a ribbon panel. Ribbon panels are made visible in the workspace by adding them to a ribbon tab. All of this is done within the Customize User Interface dialog (on the Manage ribbon tab, on the Customization panel, click the User Interface tool, or type CUI at the Command prompt).
Where to create your ribbon customizations will depend upon your particular situation and preferences, but it is generally considered good practice to keep your customizations separate from the out-of-the-box files whenever possible. This will make it easier to track and maintain them, as well as bring them forward when deploying a new version in the future. The example here will make use of a separate CUIx file (AECRibbonTool.cuix), loaded as a partial customization file, to create ribbon tools on a new ribbon panel, which will then be added to a new ribbon tab. A ribbon panel defined in a partial customization file can be added to a ribbon tab defined in any currently loaded customization file. So even if you want to add your new panel to an existing ribbon tab, you can define it in a separate partial customization file and limit your customization of an out-of-the-box customization file to adding the new panel to the ribbon tab.
Create and Load the Partial Customization File
Figure 2 – AECRibbonTool.cuix partial customization file loaded and selected.
Figure 3 - Ribbon Tools Panel properties.
Figure 4 - Vending Machine command properties.
Figure 5 - Drag-n-drop the command on the panel.
Figure 6 – Ribbon Tools panel with Vending Machine as a tool and an Office Equipment split button with three tools on the drop-down.
Create a Ribbon Tab and Add the Panel
Figure 7 - Drag-n-drop the panel on the tab.
You will now need to manually add a new tab to the desired Workspace(s). (If you set the panel to be added when loading as a partial file, you could unload the file and then reload it to add the tab to all Workspaces.)Figure 8 - The Ribbon Tools panel on the AEC Content tab.
The out-of-the-box AutoCAD Architecture ribbon tabs include a number of tools that allow you to add AEC content such as elevation and section marks, keynotes, leaders, display themes, schedule tags and schedule tables. Rather than duplicate the abilities of tool palette tools to import styles or definitions from a source file when necessary and to preset property values, these ribbon tools “run” a tool palette tool, through the AECRIBBONTOOL command.
To create a ribbon tool for your own custom content, you will need a tool palette tool for the content and an editable customization file in which you can add a ribbon tool.
Tool Palette Tool
Any tool palette tool that exists in the current workspace can be referenced from a ribbon tool, whether or not the palette on which the tool resides is included in the current tool palette group. If the ribbon tool is to be shared with others, everyone will need to have the referenced tool and you will not want the tool or the palette on which it resides to be easily deleted or edited. The out-of-the-box setup achieves this by having the ribbon tools reference tools that are on a read-only palette that is not part of any of the out-of-the-box tool palette groups. To see this palette, you need to set “All Palettes” current. Depending on what profile is set current, this palette may be called Ribbon Tools – AutoCAD Architecture (US Imperial), Ribbon Tools – AutoCAD Architecture (US Metric), Ribbon Tools – AutoCAD Architecture (UK) or a palette associated with the localized content your are using. You may want to set up a similar read-only palette for the tools that will be referenced by your ribbon tools, if you do not have a read-only, network-based tool palette location that everyone has in their workspace.
Customization File
Ribbon tools are created in a CUIx file by placing commands on a ribbon panel. Ribbon panels are made visible in the workspace by adding them to a ribbon tab. All of this is done within the Customize User Interface dialog (on the Manage ribbon tab, on the Customization panel, click the User Interface tool, or type CUI at the Command prompt).
Where to create your ribbon customizations will depend upon your particular situation and preferences, but it is generally considered good practice to keep your customizations separate from the out-of-the-box files whenever possible. This will make it easier to track and maintain them, as well as bring them forward when deploying a new version in the future. The example here will make use of a separate CUIx file (AECRibbonTool.cuix), loaded as a partial customization file, to create ribbon tools on a new ribbon panel, which will then be added to a new ribbon tab. A ribbon panel defined in a partial customization file can be added to a ribbon tab defined in any currently loaded customization file. So even if you want to add your new panel to an existing ribbon tab, you can define it in a separate partial customization file and limit your customization of an out-of-the-box customization file to adding the new panel to the ribbon tab.
Create and Load the Partial Customization File
- On the Manage tab, on the Customization panel, click the User Interface tool (or type CUI at the Command prompt).
- Click the Transfer tab, if it is not current.
- On the right side, click the Create a new customization file button.
- In the Save As dialog, navigate to the folder in which you want to save the new customization file, enter a name for the file (AECRibbonTool.cuix will be used below) and click Save.
- Click on the Customize tab. At the lower right corner, if the arrow button is pointing to the right (">"), click on that button to expand the dialog. If the button is pointing to the left ("<"), the dialog is already expanded and the button should not be selected.
- On the left side, near the top of the Customizations in... pane, click on the Load partial customization file button.
- In the Open dialog, navigate to the folder where you saved your new customization file, select the file and click Open.
- With the Customize User Interface dialog still open, in the Customizations in… pane, verify the drop-down list just below the title bar shows the name of your new customization file (aecribbontool.cuix); if not, select your file name on the drop-down list to filter the information shown to just that of the partial file.
- In the Customizations in... pane, expand the Ribbon node.
- Right click the Panels node, and choose New Panel.
- Enter a name for your panel. The example panel will be used on a ribbon tab called "AEC Content", so the panel is named AEC Content - Ribbon Tools. Press ENTER to register the name.
- In the Properties pane, notice that both the Name and Display Text properties have been set to your panel name. If you prefixed your panel name with the name of the tab, edit the Display Text property to show just the panel name (Ribbon Tools). This is what will show on the title bar of the panel.
- KeyTips provide access to ribbon tools via the keyboard (after pressing the ALT key). For panels with tools in the slideout, enter a string of up to three characters in the KeyTip property to enable the user to expand the panel from the keyboard and access the tools in the slideout. Panels without slideout tools do not need a KeyTip string.
- Repeat Steps 10 - 13 as required to create the panels you need. When you are done creating panels, click the Apply button to save the current changes to the CUIx file.
- With the Custom User Interface dialog still open, in the Command List pane at bottom left, click the Create a new command button.
- In the Properties pane, enter the following information for the ribbon tool command:
- Name: Enter the tool name (Vending Machine).
- Description: Describe the purpose of the tool, for the tool tip.
- Extended Help File: Optional! See the Customization Guide in the Help for information on creating an XAML file to provide extended help in the tool tip.
- Command Display Name: Enter a string representing the command macro, for the tool tip (AECRIBBONTOOL Vending Machine).
- Macro: Enter the macro string that the command will execute directly in the edit box or click on the ellipsis button to enter/edit the macro in the Long String Editor dialog. An AECRibbonTool command macro should look similar to this:
^C^C_AecRibbonTool Vending Machine - ribbon;
Replace Vending Machine - ribbon with the name of the tool palette tool you want the ribbon tool to invoke. - Tags: Enter any key words to be associated with your ribbon tool. These are used as part of the command search feature on the Application Menu.
- Element ID: A default value is entered automatically, and is used to reference the macro programmatically. Enter your own value, if you like.
- Images: The small (16 x 16 pixels) and large (32 x 32 pixels) images can be specified from external files here, or use the Button Image pane to select from the available images, import a file (BMP) or draw your own.
TIP: Click the Edit button in the Button Image pane to open the Button Editor. The light gray color at the bottom of the left column of colors will be treated as "clear" allowing the background color of the ribbon to show through, including the blue-green highlight when hovering over a button. Use this color for pixels at the edge, beyond the image proper.
- In the Command List pane, left click and drag your newly defined command up onto the Customizations in… pane, position your cursor on the Row 1 node of the ribbon panel created in Step 10 and release the mouse button to add the command to that row.
- On the right side, you will see a preview image of the panel and have access to the Button Image and Properties panes.
- Enter a value for the Name property only if you want the ribbon tool name to be different from the command name.
- Choose a Button Style, which controls the button size and associated text, if any.
- Most of the other properties will be filled in with the same values as those specified for the command, and changing them here will also change them for the command.
- Enter up to three characters in the KeyTip property to specify a key sequence unique to the ribbon tab on which the tool’s panel will appear.
- Repeat Steps 15 – 18 to create and place additional commands. Add rows, sub-panels, and drop-downs to organize your tools, as desired. When you are done creating and adding commands, click the Apply button to save the current changes to the CUIx file.
Create a Ribbon Tab and Add the Panel
- Skip down to Step 24 if you intend to add your new panel(s) to an existing ribbon tab. Otherwise, with the Customize User Interface dialog still open, in the Customizations in... pane, right click on the Tabs node and choose New Tab from the context menu.
- Type a name for your tab (AEC Content) and press ENTER to register the name.
- In the Properties pane, use the Default Display property to set whether or not the tab is automatically added to the Workspace(s) when loaded as a partial CUIx.
- Enter up to three characters for the KeyTip property. You must do so for the tab if you want the KeyTips entered for the tools to work.
- Skip to Step 25 if you created a new tab for your panel(s). If you are adding your panel to an existing ribbon tab from a different CUIx file, choose All Customization Files in the drop-down at the top of the Customizations in... pane.
- Expand the nodes to expose Customization File Name > Ribbon > Tabs for the customization file that has the target tab.
- Expand the nodes to expose the panels to be added, under you newly created customization file (AECRIBBONTOOL).
- In the Customizations in... pane, left click and drag the name of the panel to be added (AEC Content - Ribbon Tools) from under the Panels node to the name of the target tab and release the mouse button.
- Add additional panels, if you have them. Drag the panel names under a tab to change the order of the panels on the tab.
- When you are done adding panels to tabs, click the Apply button to save the current changes to the CUIx file.
You will now need to manually add a new tab to the desired Workspace(s). (If you set the panel to be added when loading as a partial file, you could unload the file and then reload it to add the tab to all Workspaces.)
- With the Customize User Interface dialog still open, set the drop-down at the top of the Customize in... pane to All Customization Files.
- Under the main customization file (ACA in the example here), expand the Workspaces node and select the name of a Workspace to which you want your new tab added.
- In the Workspace Contents pane at top right, click the Customize Workspace button.
- In the Customizations in... pane, expand the nodes to expose Partial Customization Files > Customization File Name (AECRIBBONTOOL) > Ribbon > Tabs.
- Click the toggle in front of each tab name to be added to the Workspace, or click the toggle in front of the Tabs node to add all of the tabs under the node.
- In the Workspace Contents pane, select a tab name and review its properties. Tabs can be included in a Workspace but not displayed, if the Show property is set to No. A ToolPalette Group can be associated with a ribbon tab, if you want.
- Click on the Done button to exit the editing of that Workspace.
- Repeat Steps 29 - 34 to add your new tab to additional Workspaces.
- Click the OK button to accept the changes made, close the CUI dialog and return to the drawing.
September 30, 2013
ActiveX and AutoLISP Programming Tip 2
In this previous post, I provided the code for getting the AecArchBaseApplication object. This object provides access to a number of values that I previously obtained through DXF access to the dictionaries (which is no longer exposed). Assuming that you have saved the AecArchBaseApplication object to a variable called archBaseApp, the following code examples show how to obtain the noted objects and values:
Use vlax-dump-object on the AecArchBase Preferences object to see a list of all of the properties stored there.
In some cases, the values returned will be self-explanatory, such as the DatabaseScale, which is the scale factor associated with the current scale. For example, if the current model tab drawing scale is set to 1/4" = 1'-0", the DatabaseScale value will be 48.0. For items that are yes/no toggles, such as CreateDimscaleOverride, the value will be an integer. No (or false, or unchecked) is 0 (zero). Yes (or true, or checked) could be any other number, but is generally (always?) returned as -1 (negative one). Other values, such as LinearUnit, will seem more cryptic. If the current linear unit is set to "Inch", LinearUnit will return an integer value of 31. Properties such as LinearUnit return "enumerated values" (or "enums"), where each possible value is assigned a numeric value which may or may not have anything to do with the meaning it represents. The AutoCAD® Architecture Developer Help has a section that lists several of the enums used by AutoCAD Architecture and AutoCAD. Expand the AEC Base Automation Reference node and then the Enums node below that, and select the AecBuiltInUnit Enum for a listing of the various values and their meaning. As indicated in the image below, 31 is the enum for Inch.
;;; To get values from the currently active document, you need to get that
;;; object, which is stored in a property of the AecArchBaseApplication:
(setq docActive (vlax-get-property appAecArchBase 'ActiveDocument))
;;; With the active document in hand, you can get the AecArchBase
;;; Preferences object:
(setq objAecArchBasePref
(vlax-get-property docActive-AecArchBase 'Preferences)
)
;;; The AecArchBase Preferences object contains a number of values of
;;; interest, including those shown below.
;;; Model "tab" drawing scale:
(vlax-get-property objAecArchBasePref 'DatabaseScale)
;;; The auto-import Layer Standards/Layer Key Style file:
(vlax-get-property objAecArchBasePref 'LayerFile)
;;; The currently active Layer Key Style:
(vlax-get-property objAecArchBasePref 'LayerStandard)
;;; Yes, the property is named "LayerStandard", but the value stored
;;; is the current Layer Key Style, not the associated Layer Standard.
;;; The annotation plot size:
(vlax-get-property objAecArchBasePref 'TextHeight)
;;; Whether or not a DIMSCALE override is automatically created
;;; when you change scales and the current dimension style is not
;;; annnotative:
(vlax-get-property objAecArchBasePref 'CreateDimscaleOverride)
;;; The various units settings can be accessed through the Preferences
;;; object also, such as the current linear unit:
(vlax-get-property objAecArchBasePref 'LinearUnit)Use vlax-dump-object on the AecArchBase Preferences object to see a list of all of the properties stored there.
In some cases, the values returned will be self-explanatory, such as the DatabaseScale, which is the scale factor associated with the current scale. For example, if the current model tab drawing scale is set to 1/4" = 1'-0", the DatabaseScale value will be 48.0. For items that are yes/no toggles, such as CreateDimscaleOverride, the value will be an integer. No (or false, or unchecked) is 0 (zero). Yes (or true, or checked) could be any other number, but is generally (always?) returned as -1 (negative one). Other values, such as LinearUnit, will seem more cryptic. If the current linear unit is set to "Inch", LinearUnit will return an integer value of 31. Properties such as LinearUnit return "enumerated values" (or "enums"), where each possible value is assigned a numeric value which may or may not have anything to do with the meaning it represents. The AutoCAD® Architecture Developer Help has a section that lists several of the enums used by AutoCAD Architecture and AutoCAD. Expand the AEC Base Automation Reference node and then the Enums node below that, and select the AecBuiltInUnit Enum for a listing of the various values and their meaning. As indicated in the image below, 31 is the enum for Inch.
Labels:
ACA,
ActiveX,
AMEP,
AutoLISP,
Object Model
August 23, 2013
AutoCAD: AutoComplete vs Alias
As you can see in the image above, my Command Line Suggestion list currently has FILLET as the top-ranked response after typing "F" at the Command: prompt. But it did not start out that way, and, to my annoyance, I found that the AutoComplete feature was frequently trumping my "F" command alias for FILLET. More often than not, it was executing the Express Tools FASTSEL command, no matter how quickly I hit the Enter key after typing the "F", because that command was at the top of the list. Initially, FILLET was not even visible on the list, without scrolling down. Yes, you can type additional characters to limit the choices, but the whole point of assigning a single-character command alias is to be able to execute a very-often-used command quickly.
I was made aware of this "issue" in a thread in the Autodesk® AutoCAD® Architecture Discussion Group, and discovered something of a workaround, if you both like the AutoComplete feature [I do] and yet want to be able to use command aliases. The workaround is not foolproof, and in cases where you frequently use multiple commands that start with the same letter, it may not be "permanent".
The workaround is simple, if tedious. Select the Customize tool on the Command Line (wrench icon) and then choose Input Search Options from the context menu that displays.
In the Input Search Options dialog, in the AutoComplete area in the upper left, verify that the According to frequency of usage radio button is selected, under Sort suggestions. If you choose Alphabetically, the list will always remain alphabetic; choosing According to frequency of use allows the commands you use most often to rise to the top of the list.
Also check the delay time at the bottom of the left side. The default value of 300 milliseconds was more than enough time for my single-character alias, you may want to increase this if you want to assure that the Command Line Suggestion List does not pop up if you have a longer alias, as there will not be any commands on the list with AutoComplete disabled. Finally, clear the checkmark next to Enable AutoComplete, to temporarily disable this feature. This will allow the command alias to be used without any interference from the AutoComplete feature. Select OK to accept the settings and dismiss the Input Search Options dialog.
Now for the tedious part: run the command you want at the top of the list repeatedly. I did not count how many times I needed to run the FILLET command to get it to the top of the list, but it was quite a few. In my case, it was probably made worse because I ran the FASTSEL command quite a few times while I was investigating this phenomenon. Once you get tired of running the command, open the Input Search Options dialog again and enable AutoComplete. Then type your alias and wait for the AutoComplete/Command Line Suggestion List to display, and see if your command is at the top. If it is, you should be able to use the command alias and get the desired command every time. If not, disable AutoComplete again and run the command repeatedly again.
Once your command is at the top, and if you increased the delay time, you may want to set it back to 300. You can do that in the Input Search Options dialog, or by changing the INPUTSEARCHDELAY system variable (which can be accessed by selecting the Customize tool on the Command Line, and then choosing Input Settings > Delay Time).
If you would rather just not deal with AutoComplete, you can disable this feature entirely by deselecting all of the options in the Input Search Options dialog (AutoComplete, AutoCorrect, Search system variables and Search content at command line).
I was made aware of this "issue" in a thread in the Autodesk® AutoCAD® Architecture Discussion Group, and discovered something of a workaround, if you both like the AutoComplete feature [I do] and yet want to be able to use command aliases. The workaround is not foolproof, and in cases where you frequently use multiple commands that start with the same letter, it may not be "permanent".
The workaround is simple, if tedious. Select the Customize tool on the Command Line (wrench icon) and then choose Input Search Options from the context menu that displays.
In the Input Search Options dialog, in the AutoComplete area in the upper left, verify that the According to frequency of usage radio button is selected, under Sort suggestions. If you choose Alphabetically, the list will always remain alphabetic; choosing According to frequency of use allows the commands you use most often to rise to the top of the list.
Also check the delay time at the bottom of the left side. The default value of 300 milliseconds was more than enough time for my single-character alias, you may want to increase this if you want to assure that the Command Line Suggestion List does not pop up if you have a longer alias, as there will not be any commands on the list with AutoComplete disabled. Finally, clear the checkmark next to Enable AutoComplete, to temporarily disable this feature. This will allow the command alias to be used without any interference from the AutoComplete feature. Select OK to accept the settings and dismiss the Input Search Options dialog.
Now for the tedious part: run the command you want at the top of the list repeatedly. I did not count how many times I needed to run the FILLET command to get it to the top of the list, but it was quite a few. In my case, it was probably made worse because I ran the FASTSEL command quite a few times while I was investigating this phenomenon. Once you get tired of running the command, open the Input Search Options dialog again and enable AutoComplete. Then type your alias and wait for the AutoComplete/Command Line Suggestion List to display, and see if your command is at the top. If it is, you should be able to use the command alias and get the desired command every time. If not, disable AutoComplete again and run the command repeatedly again.
Once your command is at the top, and if you increased the delay time, you may want to set it back to 300. You can do that in the Input Search Options dialog, or by changing the INPUTSEARCHDELAY system variable (which can be accessed by selecting the Customize tool on the Command Line, and then choosing Input Settings > Delay Time).
If you would rather just not deal with AutoComplete, you can disable this feature entirely by deselecting all of the options in the Input Search Options dialog (AutoComplete, AutoCorrect, Search system variables and Search content at command line).
August 15, 2013
Revit: Type Catalogs
A few months back I had my first experience with creating an Autodesk® Revit® family driven by a type catalog. I am finally getting around to documenting some of what I learned, so I do not have to learn it again, next time. For the record, the observations below were made while using Revit Architecture 2012; I have not yet worked with type catalogs in the 2014 release.
Yes/No Parameters
The column header format for Yes/No Parameters is: [ParameterName]##other##
where [ParameterName] is the name of the Yes/No parameter. The values assigned to this parameter for each type need to be either 0, for No, or 1, for Yes.
Text Parameters
If your type catalog includes a text-type parameter, such as the out-of-the-box Type Comments parameter, you have to add a value to that parameter in the family file. If the parameter is left unedited, when you try to load the family, you will get a Warning......and none of the values in your type catalog will be imported into the type(s) you chose to load into your project. If you edit the text parameter in the family, even by simply typing a single character and then deleting it, Revit recognizes that the parameter has been edited and will load the type catalog values as expected. In order to avoid confusing myself, I plan to leave some visible text in the family for each text parameter I have in the type catalog, so that I can see that the parameter has been edited. If a type needs a text parameter to be empty or blank, a blank value in the type catalog will overwrite the value in the family file, leaving the value of that parameter blank for that type.
Editing the Type Catalog
Yes/No Parameters
The column header format for Yes/No Parameters is: [ParameterName]##other##
where [ParameterName] is the name of the Yes/No parameter. The values assigned to this parameter for each type need to be either 0, for No, or 1, for Yes.
Text Parameters
If your type catalog includes a text-type parameter, such as the out-of-the-box Type Comments parameter, you have to add a value to that parameter in the family file. If the parameter is left unedited, when you try to load the family, you will get a Warning......and none of the values in your type catalog will be imported into the type(s) you chose to load into your project. If you edit the text parameter in the family, even by simply typing a single character and then deleting it, Revit recognizes that the parameter has been edited and will load the type catalog values as expected. In order to avoid confusing myself, I plan to leave some visible text in the family for each text parameter I have in the type catalog, so that I can see that the parameter has been edited. If a type needs a text parameter to be empty or blank, a blank value in the type catalog will overwrite the value in the family file, leaving the value of that parameter blank for that type.
Editing the Type Catalog
- Once you load from a type catalog into Revit, it puts a lock on the text file that holds the type catalog data. I had to close Revit completely (not just the model into which I loaded the types from the type catalog) to get the lock to be released so that I could rename the file. I did discover that you can open, edit and save the type catalog text file, even with the lock on it, but I wanted to replace the file with a new one generated as a CSV file from the Excel file where I was doing the editing. While I could not rename the type catalog file and then rename the new CSV to replace it without closing Revit (which does not make for a very efficient testing period), I found that I could copy a new version of the type catalog file from another folder and overwrite the old version that Revit had locked, so I amended my workflow to moving the CSV file to another folder, renaming it by changing the extension to "txt" and then moving that file to the old version's folder, overwriting it.
- If Excel (or another spreadsheet program) is used to generate the type catalog text file (by saving as a comma-separated values [CSV] file, and then changing the file extension to "txt"), you can use formulas in the Excel file to generate the values that end up in the type catalog. A formula in the Excel file can be applied on a per-type basis, whereas a formula added to a parameter in a family in Revit applies to all types in the family. As an example, the family I was generating represented the elevation of a Door. Some of the types had had glazing, and I needed to specify how far from each edge of the door the glazing started. Some glass was "full-width," with equal stiles and other glass was a lesser, given width. I was able to use a formula to calculate the glass width opening for the full-width types by subtracting twice the stile width from the overall width, while simply directly entering the value of the given-width glazing in the other types. I am sure there is a way to use multiple formulas and a Yes/No parameter to achieve that directly in a family, but since I was creating a type catalog anyway, it was nice to be able to have the flexibility to customize the formula on a per-type basis in Excel.
July 22, 2013
Software Rental and Remote Access
Here are a couple of new things that I became aware of today. I thought I would post links here in case others have not heard of these yet.
FAQ for Autodesk® Software Rental
You have to be on subscription to take advantage of the following Autodesk® Exchange application:
Autodesk® Remote
FAQ for Autodesk® Software Rental
You have to be on subscription to take advantage of the following Autodesk® Exchange application:
Autodesk® Remote
July 16, 2013
ActiveX and AutoLISP Programming Tip 1
When trying to make use of the AutoCAD® ActiveX® access to the object model through the AutoLISP® "VL" commands, the vlax-dump-object function will likely become one of your best friends. The Help sections on the object model are certainly useful, but as you test bits of code to verify that they work, I have found the vlax-dump-object function invaluable in helping me to understand exactly what properties are available for a given object.
For example, I was trying to update a subroutine I had written some years back that returned certain information about the current AutoCAD® Architecture drawing, including the drawing scale. This was before drawing scale had been added as a feature to the "vanilla" AutoCAD® software, and I had been using a DXF "hack" to get the current drawing scale from (namedobjdict) > AEC_VARS dictionary > AEC_VARS_DWG_SETUP dictionary > 40 group. In more recent releases, the CANNOSCALEVALUE system variable will give you the current annotation scale in a drawing. When Model Space is active in a Layout Viewport, however, it is possible for the viewport scale (magnification relative to Paper Space, which is presumed to be 1:1 when plotted) to be different from the annotation scale, and I wanted to be able to report both scales. By using the vlax-dump-object function in the Visual LISP Console for the ActivePViewport object, I was able to quickly see which properties changed when I changed settings in the drawing, which helped me to understand that the inverse of the CustomScale property of the ActivePViewport object would give me the scale factor for the viewport magnification, and also allow me to sidestep dealing with the enum values reported by the StandardScale (Viewport magnification) and StandardScale2 (viewport annotation scale).
Another thing that I was able to discover by using the vlax-dump-object function was that the Paper Space Viewport does not report all of the properties that other Layout Viewports report. For example, a Layout Viewport object scaled to 1/4" = 1'-0", saved to variable objVpA, might have the following properties, which can be examined using vlax-dump-object:
For the Paper Space Viewport object for that same Layout, vlax-dump-object returns the following:
The LabelBlockID property is apparently unavailable for a Paper Space Viewport and the LabelBlockId32 property is not only unavailable, but trying to get the value causes an error that terminates the vlax-dump-object function. You can get to the properties that occur alphabetically after those two, one at a time, by using the vlax-get-property function. My routine presumes that Paper Space is plotted at 1:1 and any annotation would be scaled accordingly, so it sets the scale factors for both the viewport and the annotation at 1.0 without extracting any data from the drawing.
For example, I was trying to update a subroutine I had written some years back that returned certain information about the current AutoCAD® Architecture drawing, including the drawing scale. This was before drawing scale had been added as a feature to the "vanilla" AutoCAD® software, and I had been using a DXF "hack" to get the current drawing scale from (namedobjdict) > AEC_VARS dictionary > AEC_VARS_DWG_SETUP dictionary > 40 group. In more recent releases, the CANNOSCALEVALUE system variable will give you the current annotation scale in a drawing. When Model Space is active in a Layout Viewport, however, it is possible for the viewport scale (magnification relative to Paper Space, which is presumed to be 1:1 when plotted) to be different from the annotation scale, and I wanted to be able to report both scales. By using the vlax-dump-object function in the Visual LISP Console for the ActivePViewport object, I was able to quickly see which properties changed when I changed settings in the drawing, which helped me to understand that the inverse of the CustomScale property of the ActivePViewport object would give me the scale factor for the viewport magnification, and also allow me to sidestep dealing with the enum values reported by the StandardScale (Viewport magnification) and StandardScale2 (viewport annotation scale).
Another thing that I was able to discover by using the vlax-dump-object function was that the Paper Space Viewport does not report all of the properties that other Layout Viewports report. For example, a Layout Viewport object scaled to 1/4" = 1'-0", saved to variable objVpA, might have the following properties, which can be examined using vlax-dump-object:
_$ (vlax-dump-object objVpA)
; IAcadPViewport: IAcadPViewport Interface
; Property values:
; Application (RO) = #
; ArcSmoothness = 10000
; Center = (17.8157 11.25 0.0)
; Clipped (RO) = 0
; CustomScale = 0.0208333
; Direction = (0.0 0.0 6889.41)
; DisplayLocked = 0
; Document (RO) = #
; GridOn = -1
; Handle (RO) = "E84"
; HasExtensionDictionary (RO) = -1
; HasSheetView (RO) = 0
; Height = 22.5
; Hyperlinks (RO) = #
; LabelBlockId = 0
; LabelBlockId32 = 0
; Layer = "G-Anno-Nplt-N"
; LayerPropertyOverrides (RO) = 0
; LensLength = 50.0
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; ModelView = nil
; ObjectID (RO) = 60
; ObjectID32 (RO) = 60
; ObjectName (RO) = "AcDbViewport"
; OwnerID (RO) = 61
; OwnerID32 (RO) = 61
; PlotStyleName = "ByLayer"
; ShadePlot = 0
; SheetView = nil
; SnapBasePoint = (0.0 0.0)
; SnapOn = 0
; SnapRotationAngle = 0.0
; StandardScale = 26
; StandardScale2 = 7
; Target = (1690.27 1160.54 0.0)
; TrueColor = #
; TwistAngle = 0.0
; UCSIconAtOrigin = -1
; UCSIconOn = -1
; UCSPerViewport = -1
; ViewportOn = -1
; Visible = -1
; VisualStyle = 1
; Width = 35.3685 For the Paper Space Viewport object for that same Layout, vlax-dump-object returns the following:
_$ (vlax-dump-object objVpA)
; IAcadPViewport: IAcadPViewport Interface
; Property values:
; Application (RO) = #
; ArcSmoothness = 10000
; Center = (24.3525 19.3312 0.0)
; Clipped (RO) = 0
; CustomScale = 1.0
; Direction = (0.0 0.0 1.0)
; DisplayLocked = 0
; Document (RO) = #
; GridOn = 0
; Handle (RO) = "1FB"
; HasExtensionDictionary (RO) = 0
; HasSheetView (RO) = 0
; Height = 36.5272
; Hyperlinks (RO) = #
; LabelBlockId = Exception occurred
; LabelBlockId32 = ; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Exception occurred: 0xC0000005 (Access Violation)
The LabelBlockID property is apparently unavailable for a Paper Space Viewport and the LabelBlockId32 property is not only unavailable, but trying to get the value causes an error that terminates the vlax-dump-object function. You can get to the properties that occur alphabetically after those two, one at a time, by using the vlax-get-property function. My routine presumes that Paper Space is plotted at 1:1 and any annotation would be scaled accordingly, so it sets the scale factors for both the viewport and the annotation at 1.0 without extracting any data from the drawing.
Labels:
ACA,
ActiveX,
AMEP,
AutoLISP,
Object Model
July 04, 2013
ActiveX Access to ACA/AMEP Drawing Settings
Updated 10/26/2019 to add support for versions 2015 through 2020 to the AECAPPVER code.
Since the 2010 releases, the AEC data stored in "dictionaries" has not been accessible through AutoLISP® entities/entity data, as it had been previously, through statements such as:
I recently had the time and opportunity to investigate the use of the Visual LISP® functions to access the drawing data to access the data previously available through entity data.
The keys to getting ACA or AMEP data are understanding the Object Model, so that you know which Application holds the data of interest, a willingness to explore the Object Model, so you can find things that are exposed in locations other than what the object model suggests, and knowing that the "undocumented" vla-GetInterfaceObject function can be used to access those Applications and thereby the Object Model elements defined/stored therein.
The Help menu (in recent releases, in the upper right corner of the ACA/AMEP window, to the right of the InfoCenter and to the left of the Minimize/Maximize/Close buttons) has a choice called AutoCAD® Architecture Developer Help (in ACA) or AutoCAD® MEP Developer Help (in AMEP) that will open "local" Help files that explain the Object Models and available objects, methods and properties. AMEP users will need to see the ACA file, which can also be found under the installation directory (C:\Program Files\Autodesk\AutoCAD 2014\Help\adtauto.chm for my installation of the 2014 Building Design Suite). The AMEP file can also be found in the same folder (absauto.chm).
The loading of the Application objects is version-dependent, so the first step on my journey was to write a subroutine to return the proper string indicating the version of the release of ACA/AMEP running. Because many of the routines I am trying to update were written in the ADT 3.3/2004 time frame, I have chosen to include releases back to that time in this function. Unfortunately, I no longer have access to many of those releases to verify the AEC version numbers, so some of the return values in the routine are based on my best guess. If anyone is still running any of the the releases marked "verify", please do verify the values before trying to use the following code. And if you do, and are so inclined, I would appreciate a comment to this post either verifying that I guessed correctly or providing the right values. The subroutine initially tests to see if ACA or AMEP is running, and returns nil if aecarchbase.dbx or aecarchbasenn.dbx is not loaded, where nn is a two-digit number indicating a specific release from 2007 or earlier. If it is not loaded, then the subroutine ends with a warning to the user and returns nil, since there is little point looking for information that does not exist. The calling routine will have to determine how to handle the return of a nil value.
With the subroutine above loaded, you can access the AecArchBaseApplication with this code
I will post more of my findings as I develop them.
Backstory Behind This Post:
Many years back, I did a lot of customization in AutoCAD® using AutoLISP, and was particularly pleased when the Visual LISP was introduced, as I made extensive use of the Visual LISP interactive development environment (VLIDE). While perhaps somewhat less slick that the equivalent setup for Visual Basic, it none the less made writing, testing and debugging a LISP routine or project much easier than using Notepad or a DOS text editor. I never really worked with the Visual LISP commands that were added to the AutoLISP arsenal at that time, however, and the time I had for customization dwindled with increasing project responsibilities and with attempting to master Architectural Desktop/AutoCAD Architecture.
I did, however, manage to find time to write a few customizations that accessed ACA settings (such as the drawing scale - before AutoCAD added that feature, Annotation Plot Size, current Layer Key Style, etc.) via DXF access to the dictionaries where that data was stored. There was little to no documentation on the structure of those dictionaries, but by working with what there was and trial and error, I was able to find the locations of various settings. My routines only read these values, and then acted accordingly; changing the values through ENTMOD was not supported and actively discouraged by Autodesk staffers. These routines stopped working in the 2010 release, because the dictionary contents were no longer exposed to DXF "hacking".
My on-the-job responsibilities shifted last year, as I moved out of the Project Architect roll and into the CAD/BIM Manager roll. I had reason to get back into customization, as I was looking for a way to expedite the processing of AutoCAD files exported from Revit, which tend to have a lot of entity-level settings (in particular, color) and which then tend not to work well for the disciplines that remain in CAD, as they are used to externally referencing the background drawings and controlling the appearance and plotting of the elements therein via layer settings. While working on that task, I had reason to become more familiar with the capabilities in the Visual LISP commands, and was reminded that I had a number of routines that no longer worked in versions more recent than 2009. I am using the rehabilitation of these routines as a pretext to become more familiar with the Visual LISP commands and the ACA Object Model, as I suspect that these skills will continue to have some relevance, at least until the day that our work is all Revit and no AutoCAD.
Since the 2010 releases, the AEC data stored in "dictionaries" has not been accessible through AutoLISP® entities/entity data, as it had been previously, through statements such as:
(cdr (assoc 350 (member '(3 . "AEC_VARS") (entget (namedobjdict)))))I recently had the time and opportunity to investigate the use of the Visual LISP® functions to access the drawing data to access the data previously available through entity data.
The keys to getting ACA or AMEP data are understanding the Object Model, so that you know which Application holds the data of interest, a willingness to explore the Object Model, so you can find things that are exposed in locations other than what the object model suggests, and knowing that the "undocumented" vla-GetInterfaceObject function can be used to access those Applications and thereby the Object Model elements defined/stored therein.
The Help menu (in recent releases, in the upper right corner of the ACA/AMEP window, to the right of the InfoCenter and to the left of the Minimize/Maximize/Close buttons) has a choice called AutoCAD® Architecture Developer Help (in ACA) or AutoCAD® MEP Developer Help (in AMEP) that will open "local" Help files that explain the Object Models and available objects, methods and properties. AMEP users will need to see the ACA file, which can also be found under the installation directory (C:\Program Files\Autodesk\AutoCAD 2014\Help\adtauto.chm for my installation of the 2014 Building Design Suite). The AMEP file can also be found in the same folder (absauto.chm).
The loading of the Application objects is version-dependent, so the first step on my journey was to write a subroutine to return the proper string indicating the version of the release of ACA/AMEP running. Because many of the routines I am trying to update were written in the ADT 3.3/2004 time frame, I have chosen to include releases back to that time in this function. Unfortunately, I no longer have access to many of those releases to verify the AEC version numbers, so some of the return values in the routine are based on my best guess. If anyone is still running any of the the releases marked "verify", please do verify the values before trying to use the following code. And if you do, and are so inclined, I would appreciate a comment to this post either verifying that I guessed correctly or providing the right values. The subroutine initially tests to see if ACA or AMEP is running, and returns nil if aecarchbase.dbx or aecarchbasenn.dbx is not loaded, where nn is a two-digit number indicating a specific release from 2007 or earlier. If it is not loaded, then the subroutine ends with a warning to the user and returns nil, since there is little point looking for information that does not exist. The calling routine will have to determine how to handle the return of a nil value.
(defun AECAPPVER ( ; No arguments.
/ ;_ Local variable:
sacdvr ; String stored in ACADVER system variable.
) ;_ End arguments and local variables.
(setq sacdvr (getvar "ACADVER"))
;; Return appropriate string:
(cond ; cond A.
((not
(or
(member "aecarchbase.dbx" (arx))
(member "aecarchbase50.dbx" (arx))
; DBX file name not verified for 2007.
(member "aecarchbase47.dbx" (arx))
(member "aecarchbase45.dbx" (arx))
; DBX file name not verified for 2005.
(member "aecarchbase40.dbx" (arx))
; DBX file name not verified for 2004.
(member "aecarchbase30.dbx" (arx))
; DBX file name not verified for 3.3.
) ;_ End or.
) ;_ End not.
;; ACA or AMEP is not running.
(alert
(strcat
"Unsupported version of AutoCAD Architecture/MEP is running."
"\nACADVER = "
sacdvr
"."
"\n\nPlease notify the CAD/BIM IT Staff."
) ;_ End strcat.
) ;_ End alert.
nil ; Return nil.
) ;_ End condition A.1.
((= "15.06" sacdvr) ; ADT 3.3.
".3.0" ; VERIFY THIS RETURN STRING!
) ;_ End condition A.2.
((= "16.0" sacdvr) ; ADT 2004.
".4.0" ; VERIFY THIS RETURN STRING!
) ;_ End condition A.3.
((= 16.1 (atof sacdvr)) ; ADT 2005.
".4.5" ; VERIFY THIS RETURN STRING!
) ;_ End condition A.4.
((= 16.2 (atof sacdvr)) ; ADT 2006.
".4.7" ; VERIFY THIS RETURN STRING!
) ;_ End condition A.5.
((= 17.0 (atof sacdvr)) ; ADT 2007.
".5.0" ; VERIFY THIS RETURN STRING!
) ;_ End condition A.6.
((= 17.1 (atof sacdvr)) ; ADT 2008.
".5.5" ; Return string.
) ;_ End condition A.7.
((= 17.2 (atof sacdvr)) ; ADT 2009.
".5.7" ; VERIFY THIS RETURN STRING!
) ;_ End condition A.8.
((= 18.0 (atof sacdvr)) ; ADT 2010.
".6.0" ; Return string.
) ;_ End condition A.9.
((= 18.1 (atof sacdvr)) ; ADT 2011.
".6.5" ; Return string.
) ;_ End condition A.10.
((= 18.2 (atof sacdvr)) ; ADT 2012.
".6.7" ; VERIFY THIS RETURN STRING!
) ;_ End condition A.11.
((= 19.0 (atof sacdvr)) ; ADT 2013.
".7.0" ; Return string.
) ;_ End condition A.12.
((= 19.1 (atof sacdvr)) ; ADT 2014.
".7.5" ; Return string.
) ;_ End condition A.13.
((= 20.0 (atof sacdvr)) ; ACA 2015.
".7.7" ; Return string.
) ;_ End condition A.14.
((= 20.1 (atof sacdvr)) ; ACA 2016.
".7.8" ; Return string.
) ;_ End condition A.14.
((= 21.0 (atof sacdvr)) ; ACA 2017.
".7.9" ; Return string.
) ;_ End condition A.15.
((= 22.0 (atof sacdvr)) ; ACA 2018.
".8.0" ; Return string.
) ;_ End condition A.15.
((= 23.0 (atof sacdvr)) ; ACA 2019.
".8.1" ; Return string.
) ;_ End condition A.16.
((= 23.1 (atof sacdvr)) ; ACA 2020.
".8.2" ; Return string.
) ;_ End condition A.17.
(T ; Unsupported version running.
(alert
(strcat
"Unsupported version of AutoCAD is running."
"\nACADVER = " sacdvr "."
"\n\nPlease notify the CAD/BIM IT Staff."
) ;_ End strcat.
) ;_ End alert.
nil ; Return nil.
) ;_ End condition A.18.
) ;_ End cond A.
) ;_ End AECAPPVER.With the subroutine above loaded, you can access the AecArchBaseApplication with this code
(vla-GetInterfaceObject
(vlax-get-acad-object)
(strcat "AecX.AecArchBaseApplication" (aecappver))
)I will post more of my findings as I develop them.
Backstory Behind This Post:
Many years back, I did a lot of customization in AutoCAD® using AutoLISP, and was particularly pleased when the Visual LISP was introduced, as I made extensive use of the Visual LISP interactive development environment (VLIDE). While perhaps somewhat less slick that the equivalent setup for Visual Basic, it none the less made writing, testing and debugging a LISP routine or project much easier than using Notepad or a DOS text editor. I never really worked with the Visual LISP commands that were added to the AutoLISP arsenal at that time, however, and the time I had for customization dwindled with increasing project responsibilities and with attempting to master Architectural Desktop/AutoCAD Architecture.
I did, however, manage to find time to write a few customizations that accessed ACA settings (such as the drawing scale - before AutoCAD added that feature, Annotation Plot Size, current Layer Key Style, etc.) via DXF access to the dictionaries where that data was stored. There was little to no documentation on the structure of those dictionaries, but by working with what there was and trial and error, I was able to find the locations of various settings. My routines only read these values, and then acted accordingly; changing the values through ENTMOD was not supported and actively discouraged by Autodesk staffers. These routines stopped working in the 2010 release, because the dictionary contents were no longer exposed to DXF "hacking".
My on-the-job responsibilities shifted last year, as I moved out of the Project Architect roll and into the CAD/BIM Manager roll. I had reason to get back into customization, as I was looking for a way to expedite the processing of AutoCAD files exported from Revit, which tend to have a lot of entity-level settings (in particular, color) and which then tend not to work well for the disciplines that remain in CAD, as they are used to externally referencing the background drawings and controlling the appearance and plotting of the elements therein via layer settings. While working on that task, I had reason to become more familiar with the capabilities in the Visual LISP commands, and was reminded that I had a number of routines that no longer worked in versions more recent than 2009. I am using the rehabilitation of these routines as a pretext to become more familiar with the Visual LISP commands and the ACA Object Model, as I suspect that these skills will continue to have some relevance, at least until the day that our work is all Revit and no AutoCAD.
Labels:
ACA,
ActiveX,
AMEP,
AutoLISP,
Object Model
Subscribe to:
Posts (Atom)





















