Autodesk Fabrication 2022 marks a decade that I’ve been updating various documentation for the program. As usual, in recent years not a lot has changed but there are a few changes. Here’s a review of the changes for the data I track…
ActiveX is a framework developed by Microsoft in 1996 which adapts earlier concepts of COM (Component Object Model) and OLE (Object Linking and Embedding). Most people may think of this as Visual Basic (pre .Net era) programming.
This was supposed to fade away as Microsoft moved to the .Net based languages so Autodesk pulled support in the shipping versions of AutoCAD years ago. It was however still available as a separate download for a limited time but that time never arrived. Microsoft kept it around and still today, Autodesk supports VBA, a version of Visual Basic embedded within the Application over half a decade later.
If you’e not interested in programming AutoCAD in VB or VBA but do use AutoLISP, I’d encourage you to keep reading, this article is still for you.
Enabling VBA in AutoCAD
If you want to take a stab at VBA programming in AutoCAD, you’ll need to install the Visual Basic Extension. The extension can be downloaded for 2016 – 2019 versions of AutoCAD from this link….https://tinyurl.com/AcadVBAInstaller
VBA Help for the AutoLISP Programmer
Now, with AutoCAD’s help now Online, you might be tempted to think that it’s the most robust help you can get from Autodesk. Simply typing “F1” will bring up AutoCAD’s help and browsing through the developer documentation, you can find documentation of AutoCAD’s ActiveX Object Model like seen in the following image.
Looking at the above image, the graphic of the Object Model contains no hyperlinks. And there’s no documentation on the Methods, Properties and Events typically available for this type of programming.
If you’re programming in VBA, the VBA Editor has tools for helping navigate this model or provides a lot of Auto Complete functionality when typing code. This doesn’t help anyone trying to program ActiveX from AutoLISP.
This is where the Offline Help comes in. You can access the OffLine Help download page from within AutoCAD by clicking the down arrow next to the question mark in the upper right corner of AutoCAD and then selecting Download Offline Help to download and install the help system.
You can also click the following link….https://tinyurl.com/Acad2019-OfflineHelp to go to the AutoCAD 2019 Offline Help download page as shown in the following image.
Configuring Offline Help
Once installed, you can configure AutoCAD to use the Offline version of Help by typing Options at the command line and clearing the toggle in the following image.
Once configured, typing “F1” will access the Offline help. One of several added pieces of Documentation which includes the ActiveX Developer’s Guide, is the ActiveX Reference Guide. You can see the graphic of the same Object Model documentation as before, but this one is hyperlinked to documentation of the Objects as well as lists all of the Methods, Properties and Events.
While all of documentation is written with the Visual Basic programmer in mind, the organization of the ActiveX object model and everything else is where you can get all the documentation you need to help translate the function calls to their AutoLISP syntax. When you make a call to (vl-load-com) in AutoLISP, you have access to over 2000 additional AutoLISP functions with a VLR- prefix. These functions are all documented here in the ActiveX Reference Guide in Visual Basic syntax.
In a future post, I’ll explain how to translate the Visual Basic documentation to AutoLISP syntax. If you don’t want to wait, review the ActiveX documentation found in the AutoLISP developer guides…it’s all in there!
One Final Note: You do NOT need to install the VBA Extensions in order to program w/ActiveX from AutoLISP. Just install with Offline Help and you’ll have everything you need.
If you’re an AutoLISP programmer and use Autodesk Fabrication CADmep, you most likely know that there’s a COD Scripting language in Autodesk Fabrication that provides read and/or write access to CADmep properties. The problem with COD Scripts, is that sometimes they’re not powerful enough to do all of the other things you’d like to do and you may want to use AutoLISP.
What you may not know is that you can access the vast majority of CADmep properties from AutoLISP. To so this, you need to configure CADmep’s List Setup dialog which will provide a light weight but similar interface to what you see when you build reports in Autodesk Fabrication.
To access List Setup, right-click in an open area or the drawing editor and then select “CADmep” -> “Setup” -> “List Setup” from the menu.
Configuring List Setup will provide access to the configured properties via DXF codes which are one of the most common ways of accessing object properties in AutoLISP. (You can also access these same DXF based properties via VBA, ARX or .Net)
The following image shows the List Setup dialog before (left) and after (right) being configured. Simply add the properties you want to extract in the order you want them.
Once you’ve configured the properties you want, a simple call to the (ENTGET) function in AutoLISP will return the data you’re looking for. You can see in the following image, that we’ve saved the DXF data to two different variables in the VisualLISP editor. The listsetup-blank variable (left) was done before configuration and the listsetup-config variable (right) was done after the configuration of List Setup.
The code used to extract the data is the following….
Because the VisualLISP editor does not word wrap it’s results, you can use the Inspect
Now, there are a few things to know about this method….
All CADmep properties show up in DXF Group Code 300. If you are returning multiple properties, you’ll have multiple 300 codes to parse through.
The order the properties are configured in List Setup is the order the properties will appear when returned in AutoLISP. There really is no other foolproof way of knowing which codes are which properties (unless obvious by their value) without knowing the order List Setup was configured.
If you later change the properties or their order, you’ll likely break your existing code. Think carefully about what you may want later and add it from the start even if you don’t want it at this time. If you need to add properties later, simply add them to the end of the list.
This method works well for reading Fabrication properties. It doesn’t allow you to set them using functions like “(ENTMOD)” or “(ENTUPD)“
I’ve updated some of the Autodesk Fabrication Resources pages. You can find the links below however you should note that none of the information has changed from 2018 to 2019. Non the less, you can review the links here…
Don’t Store Estimating Tables in Your CADmep Drawing
If your company uses ESTmep, pay close attention. CADmep stores in the DWG files most of your database with the exception of content that’s not used and reports. What this also means is that by DEFAULT, CADmep stores your Estimating Tables in every Drawing file (DWG) you produce. Most companies using ESTmep use 1.0 Factors for SMACNA, MCAA or other trade labor so exposing that data isn’t as big of a risk…everybody knows what it is. However, if you have pricing multipliers for your vendors, negotiated prices (as opposed to List Pricing) in your tables or have your own custom labor factors and rates, anyone with access to CADmep and your drawing files can EASILY extract that information from your DWG files,
This is easily changed by toggling the “Do NOT Store Est Tables with DWG Database” setting in the Edit Configuration utility as shown on the following image.
,
Setting this toggles will prevent CADmep from caching a copy of the Price Tables, Install Tables and Fabrication Tables in your drawing file, These are a few other things to note…
While this settings prompts you for which configuration to load (if you have more than one), the setting is not configuration specific. Meaning, it is not stored in your Fabrication Database. The setting applies to ALL configurations so you can pick any one you like to make this change.
This change is software VERSION specific. For example, if you run 20017 and 2018 versions of CADmep, you need to make the change in both versions.
This issue is NOT present when using Revit with Fabrication Parts. Only CADmep has this issue,
Because this setting isn’t stored in the database, that means it’s computer specific. You need to change it on each computer running CADmep.
This setting is also USER specific (stored in your Windows profile) so even if you change if for one user, if a different user logs in on the same computer, you’ll need to make the change again.
Because this setting is user specific and computer specific…and because the default setting if you do nothing is the RISKY option, it’s easy for this setting to revert back to it’s original value and save the Estimating Tables to the drawing. For this reason, you many want to consider creating an AutoLISP routine that sets this setting every time you start AutoCAD. You could also have it run from a Batch File or VBScript in the Windows Startup folder each time you log onto Windows or even have your IT Department force the setting via Group Policy or other methods. For any of these solutions, it’s as simple as automating the setting in the following Registry Key.
I’ve posted a number of Autodesk Fabrication resources for anyone using Autodesk Fabrication CADmep, EDTmep, CAMduct or Fabrication parts in Revit. You can find them using the Resources menu or by following the link here. You can also find this same information on the site XtraCAD.com. In the future, I’ll be compiling and posting additional resources that I’ve collected over the last several years in the course of administering Autodesk Fabrication databases for some large MEP firms.