Search This Blog

Tuesday, September 23, 2008

Other Modemacro goodies

The recent LT Unlimited blog article by Kate Morrical titled: "Customize the Status Bar with MODEMACRO" reminded me of some customization I recently wrote. I received a call from a remote architect who needed some assistance with Linetypes. She was concerned that when switching from model to paperspace her linetypes weren't always displaying correctly.

I explained that she should be adjusting her ltscale variables in order to see the linetypes when in modelspace. She wished for an "automatic solution". So I wrote a quick macro, using VBA, to automatically set the correct lt and psltscale values based on the current value of dimscale. I tied the macro to the AcadDocument_LayoutSwitched event so that whenever she switched layouts, the macro would update the values.

To provide graphic feedback that this system was working I chose to use the MODEMACRO system variable. Here is the macro in action with visual feedback occuring on the status bar.



Here is the code from the vba macro that sets the MODEMACRO variable. You can see from the code snippet below, that I am displaying the current value of the MEASUREMENT, DIMSCALE, LTSCALE, and PSLTSCALE variables.


ThisDrawing.SetVariable "modemacro", "WB_STATUS- UNITS: $(IF, $(=,
$(getvar,MEASUREMENT),0),IMPERIAL,METRIC) SCALE=$(GETVAR,DIMSCALE)
LTS=$(GETVAR,LTSCALE) PSLTS=$(GETVAR,PSLTSCALE)"

No comments: