Home > A CAD Dinosaur's Journey into Modern Times, AutoCAD, Workstations > A CAD Dinosaur’s Journey, Part 6: Take Me to Your Mleader!

A CAD Dinosaur’s Journey, Part 6: Take Me to Your Mleader!

Editor’s Note: Welcome to Cadalyst’s blog series by Patrick Hughes, A CAD Dinosaur’s Journey into Modern Times. In this three-month series, Hughes chronicles his transition from AutoCAD R14 to v2015 and from an outdated PC to a state-of-the-art professional workstation. Follow along and enjoy!

In my last post I discussed Mleaders. I’ll make good use of them, but to my dismay I’ve run into a little stumbling block. Nothing insurmountable mind you, but forewarned is forearmed as they say. Perhaps my problems started when I first established my standards. Rather than load my drawings with custom styles, I simply modified the Standard styles. I set my standard dimensions to display dimension and extension lines to one color and dimension text to another color. These standards applied to leaders as well.

It became complicated when I began to work with the thousands of legacy drawings I’ve accumulated over the years. Now when I work in a legacy drawing and execute Mleader, the resulting object doesn’t conform to my standard. And, yes, I have updated Mleader’s standard style in my template files. This should solve it, right? Unfortunately, it proved cumbersome getting the revised standard style into the working drawing.

An Eon Ago

Long ago I wrote a simple AutoLISP routine, Reset, that resets all system variables and other working environments back to a known state. This is handy if a macro or other tool cancels a command and doesn’t reset certain sysvars and settings such as running OSnaps, UCSIcon display, Pickbox size, and the like. When AutoCAD added the Dimassoc variable, I solved the problem by adding that to my Reset command. Things were different with the MLeader standard style because that object type was not in my legacy drawings resulting in a variable search being none. Furthermore, there isn’t a command line alternative to the MLeader Style Manager.

One of AutoCAD’s shining strengths is numerous ways you can automate tasks, including its simplest form, the Script command. Before going in that direction, I tried the Action Recorder (introduced in AutoCAD 2009) that would hopefully allow a one-click solution. Unfortunately, the input into the Mleader Style Manager failed to be recorded — the recording merely displayed the dialog box and did not record my interactions within the dialog box. While this was disappointing, I do see some potential with the Action Recorder.

I also tried Design Center, another new tool, but that also proved fruitless.

Batch processing to the rescue!

Batch Processing

I chose batch processing to overcome my dilemma. I briefly looked into using ScriptPro, however ScriptPro would have to open and close an AutoCAD session for each drawing. That would not be good. There may be a solution available in the Autodesk App Store, but I grabbed my own CadTempo batch processor that I’ve wanted to put to the test. Again, I felt it was going to be problematic to import the Standard Mleader style.

Many years ago, a chief engineer I worked for advised me on a problem solving technique that I’ve put to the test on many occasions. Essentially it involves inverting an unsuccessful attempt at a solution. In philosophical terms, if you cannot bring Mohammad to the mountain, bring the mountain to Mohammad. In dinosaur speak it goes something like: Grrr gnash gnash, Riiip, tear… Rwar.

So, I created a script template that issued the following command sequence:

New

acad

-Insert

Filename

0,0,0

1

1

0

Zoom

All

Explode

Last

-Wblock

Filename

Y

*

close

y

My first attempt replaced the FileName with the selected drawing names and then created final scripts with all the files to be processed. Unfortunately, the resulting drawings didn’t contain the correct Mleader style. I revised using a SaveAs sequence. The resulting script template is as follows:

New

acad

-Insert

Filename

0,0,0

1

1

0

Zoom

All

Explode

Last

SaveAs

2013

Filename

Y

Close

Finally, success!

Rawrrr!

In closing, AutoCAD offers an enormous amount of customization in how you work with the software, as well as how your drawing appears both on screen and plotted. You can’t expect a dinosaur with a brain the size of a walnut to see millions of years into the future and make the right decisions. But if he chooses badly, there thankfully is always a good workaround.

_________________

About the author: Patrick Hughes, machine designer and owner of Engineered Design Solutions in Rockford, Illinois, has worked with AutoCAD since 1991. He has developed a number of AutoLISP and other software solutions to automate his workflow and increase productivity, including the commercially available time tracking program, CadTempo.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: