If you’re a full time professional software developer, this is likely old news. For the rest of those who fall into the “Self-taught”, “Part Time” or “Recreational” category it may surprise you that Microsoft has a magazine dedicated to software development.
MSDN (Microsoft Developer Network) has put out the MSDN Magazine for almost 2 decades. You can access old issues here…
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.
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.
Install and Uninstall issues are common. They can be difficult and time consuming to resolve. Often, the fix is worse then the problem. Autodesk has a number of Knowledge Base articles on the topic with a variety of tips and suggestions…
One of the best options that I’ve been typically going to right from the start due to it’s high rate of success is Microsoft’s “Fit-It” utility. You can access it from the following link and clicking the Downloadbutton.
This downloads and saves a file named MicrosoftProgram_Install_and_Uninstall.meta.diagcabto your computer. When you double click this file, the program starts and as you work your way through the wizard, you’ll be prompted for which type of problem you want assistance with.
My experience had been that most Install issues are related to programs already installed incorrectly. As such, I find myself using the Uninstall option not only to resolve uninstall problems but also install problems by removing the problem programs and reinstalling those to.
Regardless of the option you choose, you’ll then be presented with a list of programs the utility finds. Select the one you think best and let the Fix-It utility do the rest. It’ll scan the registry for invalid or corrupt keys, fix if possible and even uninstall the offending program.