Jump to content

Recommended Posts

Posted

Hi,

 

I am wondering if you can program a script to enable me to change a piece of Mtext within a block.

 

I have a bunch of drawing files which have our company border on them inserted as a block, within the border block I have some Mtext giving the scheme title, unfortunatley due to things dragging along the scheme has now ran into 2010, the drawings have 2009 on them! I need a scritpt that I can open said title block and change the Mtext from 2009 to 2010 and close the block, save etc for all my drawings. Is this possible? I have scriptpro installed but dont know what to ask . . .

 

Thanks for your help

 

Dave

Posted

I wouldn't try to do the MTEXT change (if it is part of a block) with a script as there are easier ways. I would open up the block and make the changes there and then reinsert the block into the drawing. This is relatively easy using a script. You need to make sure the new block definition is available, either by putting it in the current folder or in a searched folder. Then...

 

-insert
BlockName=
0,0
1
1
0
erase
l

qsave

the = after block name tells AutoCAD to redefine the existing block from the external drawing file. If doing it by hand you can here but I don't know a way of escaping a script cleanly so I insert a new instance of the block @ 0,0, x scale, y scale (might need a z scale too?), and 0 rotation and then delete the block you have just put in. Job done :) You may need a zoom extents before the erase last as AutoCAD used to erase the last visible entry but now erases the very last entry.

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