Nate Holt's Blog

March 1, 2022

Customizing WD_M or WD_PNLM block swap/update

Filed under: Electrical — nateholt @ 10:39 am

The WD_M block instance is a handy place to store and retrieve Xdata values for your custom AcadE applications. The block is always there on the drawing if it’s AcadE-smart. But there may be times when you need to use the AcadE AESWAPWDM tool to update a project’s WD_M block instances. Unfortunately, this AESWAPWDM tool doesn’t provide a means for a mass transfer of Xdata tags/values from the old WD_M block to the swapped-in new version.

There is a way to do this. The solution is to just enhance the existing AcadE AESWAPWDM tool’s source code.

This tool is driven from an Autodesk supplied file swap_wdm.lsp provided in plain AutoLISP format. Like the wdio.lsp PLC I/O utility, it is installed and executed in full source mode to allow user customization of the WD_M / WD_PNLM block swap commands.

This swap_wdm.lsp file is installed into folder “c:\program files\autodesk\autocad 20xx\acade\support\en-us\”. Make a copy of this file (same name) and slightly enhance it to transfer the Xdata from the old WD_M to the newly inserted WD_M. Save your modified file in a support file folder that is “higher” in the search path sequence that the original swap_wdm.lsp (so that your modified version will be found first and executed).

Here is the key spot in the swap_wdm.lsp file where you would likely insert your enhancements:

Create a free website or blog at WordPress.com.