Jump to content

Recommended Posts

Posted

I have found this really cool code on the forum http://www.cadtutor.net/forum/showthread.php?41605-Change-units-from-unitless-mm-(batch-process-hundreds-of-blocks))

 

The one in focus is down the page a bit called BATCHMM. It is precisely the tool I was needing this morning to correct a big bunch of blocks which some were left unitless while others were not.

 

My question is that this will set the Insertion Scale to what I want but I'd like to also set the display format and precision formats for both measurements and angles. But I can't seem to find the variable like insunits make this happen.

 

Also, in reading up on this there appears to be another undocumented command -dwgunits which will allow for manual input of the information. But I need to run this in the batchmm program if possible. Anyone know of a good place to find other "undocumented" commands. It's like turning over a new stone with some of this stuff and finding a neat toy underneath it.

Posted

Thanks Lee-Mac. Those variables worked fine. I was wondering if you could help me a little more with this. This program is an excellent example of some of the more in depth properties of VLISP. I'm studying it line by line to understand how the author made it work. So far so good and in the meantime it's cranking on that big list of blocks and changing all of them to be uniform now. Although I notice that when it runs I can forget about doing anything else with my computer. It takes all the keystrokes and focuses them into the AutoCAD window. I can click the mouse and get some actions but as far as typing in an address in IE to look at some other information, it will not allow that. The CPU is tied up apparently doing all the opening and closing of files. No problem, I have some other machines I can tinker with while this does its work....and yes, I set it up on a test folder first and ran it to be sure it's doing what we expect. And it is...changing all the blocks one by one to be the same as far as these variables are concerned.

 

Now the question I have is that I inserted a line to ZOOM "E" after it changed the variables. I can see the command appearing on the on the command line and when I open the text window I can see that it executed but the saved copies of the block drawings are not zoomed to extents. They are just left at the zoom level that they were when they were opened. Again, no big deal but it would be nice to have all the saved block drawings zoomed to extents so when you open them you don't have to look for a part that's off in the corner of the screen. The folks who created these blocks years ago weren't to much on standards and just did things by the moment.

 

This process of opening the file and the LISP code runs on the new file is also a keen property which I'm investigating more into. I have tons of use for something like this. But I am curious as to why the zoom command doesn't get saved when the drawing is closed.

Posted

Visual LISP Zoom operations are methods of the Application Object and will hence only operate on the Active Document, and not affect other Document Objects in the Documents Collection; similarly, Zoom commands called at the command-line will only operate on the active drawing.

 

For your task, I would strongly recommend using a Script to iterate over your drawings and perform the necessary operations on your drawings. There are relatively few restrictions on the operations available when a set of drawings are processed using a Script, and furthermore, the Script process to open & close a set of drawings is far less CPU intensive, since it doesn't continuously occupy the UI processor thread that AutoLISP runs on, and consequently AutoCAD won't become unresponsive after 5 seconds when the Desktop Windows Manager (DWM) in Windows 7 doesn't receive input from the AutoCAD UI thread.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...