Jump to content

Change units from unitless - mm (batch process hundreds of blocks)


Recommended Posts

Posted

Does anyone have the time to hustle up something that would do this? Guys who made the blocks have left units at unitless.

Posted

If by "blocks" I'm guessing you mean "drawings," then try this:

 

(defun c:cb_itom( / )    (finalblitz '(("CMD" (setvar "insunits" 4))("SAVE")) '("MODEL") nil t 1))

You'll need to download and load the Batch Engine .lsp and .dcl file, you can find them by clicking the link in my signature.

 

When you run the command (cb_itom, that is), you should be presented with an option to select which drawings you want. Assuming you've got the dcl loaded properly (see the instructions in my post, you'll need to change a directory in the finalblitzpublish.lsp file), you'll see a dialog box pop up. You can use that to select the files you want.

 

If that doesn't work and you don't want to bother trying to get it to work, just using

(setvar "insunits" 4)

will set the units to what you need. Save and close, easy easy.

Posted

Just to add (as reference) the company I worked with (setting up their CAD Standards) had this very issue when switching from 2004 to 2006 ACAD, seems there was an issue with the drawings and insunits in all the blocks (like hundreds and hundreds) for Highway Design and Signing, anyway, for some reason, anytime you would insert the drawing blocks into 2006, they would scale by the imperial to metric ratio (2.54) times the block. The solution we used was the same as posted by Freerefill, had a batch program designed by a CAD Help (software supplier) to revamp our block database. I don't recall if it switches everything from unitless to meters or vise versa but I remember the issue quite well. 2006 seemed to overwrite the insunits to inches I believe, it was to an imperial unit scale and being in Canada where metric is the standard measurement platform, we had a big issue with it. Anyway, just wanted to add a similar issue as to what we experienced.

Posted
Does anyone have the time to hustle up something that would do this? Guys who made the blocks have left units at unitless.

 

You can insert all the blocks in a drawing using bi.lsp

then use edit_bloc from Giles chanteau to change all blocks units to mm.

Then extract all to particular drawings using wba.lsp

 

Or.

 

Use batchmm.lsp to open all drawings in selected directory to change their insunits to 4... and wait for autocad to open and close each drawing.

change units to mm.zip

BATCHmm.LSP

Posted

Freerefill - I'm trying your approach first - but I can't get it to work. I've added the 3 files in your sig to C drive. I can select my test file that I want to edit. I'm unsure however where I write the additional filedia code.

 

I tried adding to the end of the fb code - running this opened the test drawing but edited nothing, there was just an error.

 

It did however create a new script file on my C drive. Here's the contents:

 

open "C:/CADTemp/16BC50R.dwg"

(setq opt '(("CMD" (SETVAR "insunits" 4 ) ) ("SAVE" ) ) tabby '("MODEL" ) rep 1)

(finalblitz opt tabby T T 1)

 

 

This is new to me btw. thanks for the replies btw

Posted

It will create a new script file, it's basically a LISP which creates a script which runs the LISP which modifies the script and runs it again, thus you can open and close drawings, hence the batch process. It's kind of wronky but it works.. at least, it usually works. >.

 

If it's getting to writing the script, that's good... at least it's getting that far. What sort of error are you getting? And if you are able to open a file, does that mean that the file dialog box did indeed pop up and work more or less well?

  • 2 weeks later...
Posted

Gilsoto13 - I used your lisp and it worked great thanks.

 

Freerefill - I found yours a little complicated. Shame as I actually wanted to (ideally) change some of the linetypes and layer colours within the blocks too.

  • 4 weeks later...
Posted

I am pleased to use my first post in thanking you for this great lisp routine!

 

Worked a treat for the 500 OS tiles I had to organise

 

Regards

 

Jez

Posted
I am pleased to use my first post in thanking you for this great lisp routine!

 

Worked a treat for the 500 OS tiles I had to organise

 

Regards

 

Jez

 

I am currently dealing with over 100,000 blocks while I am still working in the greatest ever block collection...

 

I had to find everything about batch process and automatic redefine... best routines I could find for these tasks are:

 

Blockimport.lsp from Charles Alan Butler, to insert all drawing in a directory to the current drawing. That can help us to redefine them easily.

Also redefining blocks lisp Edit_bloc_3.5 from Gilles Chanteau to redefine all or selected blocks in current drawing, selecting from a the options from a dialog box (layer 0, color, linetype, units).

There are also some other routines to extract all blocks from current drawing to a selected directory, wblockall, wblockm.

And finally the batch.lsp that may allow us to open, apply all the variables we want, and close- saving each drawing from a selected directory.

Also, I used some times the purgefiles.lsp from Andrzej Gumula to batch purge and audit all drawings in a selected directory, when my autocad freezes by inserted drawing errors while using blockimport.

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...