Jump to content

Insert a block in multiple drawings using script


Arek80

Recommended Posts

Hi

I'm trying to write a script which would enable me to redefine a block, save and close the drawing. I would like to run it on multiple drawings. I have managed to write a script which does redefine the block but it stops and either I get "Unit-scaling inserted database..." message or it starts a new command..... ("Command: 1.000000")

 

I did not get the script to save the changes or close the drawings. Any help would me very much appreciated.

 

Below you will find the script file

 

(command "._insert" "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
_units 1.00
_basepoint 0,0
_scale 1.0
_rotate 0.0
)
qsave

(princ)
close

Edited by SLW210
Link to comment
Share on other sites

apologies :oops:, I did wasn't aware of code posting guidelines. Please find below coding with the code tags

 

(command "._insert" "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
_units 1.00
_basepoint 0,0
_scale 1.0
_rotate 0.0
)
qsave

(princ)
close

 

thanks,

Arek

Link to comment
Share on other sites

Thanks Bigal:D,

I modified your code a little however after I specify the rotation angle 0.0, I need to cancel modifing the attributes in the title block. How do I do it? At the moment the script is changing my attributes to "_.save", "_Y" etc....:( Any help would be very much appreciated!

 

._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
1.00
1.00
0.0
;here I need to cancel revising the attributes within title block
_.save
_Y
_.close

Link to comment
Share on other sites

Just thought will share this script which works. The empty lines are "enter" for the attributes to remain unchanged. And will use ScriptPro to apply it to multiple drawings.

 

._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
1.00
1.00
0.0















_.erase
_L

_.zoom
_E
_.qsave
_.close
_N

Link to comment
Share on other sites

I was going to post often you need extra lines as if you pressed the enter button, the other way is to uses spaces as the same thing but can be on the same line makes the script a bit easier to read sometimes if its all 1 line.

 

Try it with yours 2nd line would be next drawing.

 

open dwg1 ._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0 1 1 0.0       etc
open dwg2 ._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0 1 1 0.0     

Link to comment
Share on other sites

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