Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script files

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
whitney_jeff
793 Views, 3 Replies

Script files

I really like scripts, they automate mundane repetetive tasks.  And AutoScript freware from Cadig is awesome!

 

One of my favorite script routines is to replace an existing block with an updated version.  When I first tried to do this I could not figure out how to stop the process after redefining the block using insert =.  Mark Middlebrook came to my rescue on that, and I would like to share it with you all.

 

The basic script consists of

-insert

blockname=

(command /e "resume")

 

Of course you can add any other bits of script that you need, but once it hits the (command /e "resume") it stops the insert process after having redefined the block.

 

The ususal caveats apply - the block must reside on the search path, it must be compatible and so on.

 

I hope you find this as useful as I have! 

Tags (1)
3 REPLIES 3
Message 2 of 4
Volker_C
in reply to: whitney_jeff

Hi Jeff,

 

That's a great tip. Thanks for sharing!

 

Cheers,

Volker

Please let us know if your questions have been answered by selecting, "Accept as Solution"


Volker C.
SR Technical Support Specialist, KDE
Autodesk Customer Council | Only One AutoCAD | AutoCAD Blog

Message 3 of 4
pendean
in reply to: whitney_jeff

For those that prefer lisp, you can start with this section:

(if (tblsearch "block" blkname)
(progn
(command "._-insert" (strcat blkname "=") (command))
(princ (strcat "\nBlock " (strcase blkname) " redefined."))))
Message 4 of 4
Derek.Snow
in reply to: whitney_jeff

I enjoy scripts as well, I had a hard time getting that to work.  You can also do the old tried and true of insterting it / redefining with a path and then erasing the one you inserted.  I also typically set the expert mode to 0 before running scripts or publishing them to our group.

 

EXPERT
0
-INSERT
Di_Local_3L=P:\CADD\CADWORX_SUPPORT\V2014\REX\P&ID\Di_Local_3L.dwg
0,0
1
1
0
ERASE
L

QSAVE

 

You can do more than 1 at a time by adding multiple sequences in the same script.  I attached my script and hopefully you can download it to play with.

 (I had to change the extension from ".scr" to ".txt" for it to upload; you will need to change it back to ".scr" for it to function...and of course customize with your own block and path)

 

I hope that helps some.  Have a good one!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost