Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to add a block to numerous drawings, sample code. Help?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
461 Views, 1 Reply

Trying to add a block to numerous drawings, sample code. Help?


(setq plist (vl-directory-files (getvar "dwgprefix") "*.dwg" 1))
 
(foreach ins1 plist
 (setvar "lispinit" 0)
 (command "open" ins1)
 (command "insert" "C:\Users\asmoley\Desktop\B\SK100_BD\" "0.875,0.28125")
 (command "save" ins1)
 );foreach
 (setq plist nil)

 

bad variable name in SETQ and malformed string on input errors.  I am a very inexperienced programmer.  Help?

1 REPLY 1
Message 2 of 2
Lee_Mac
in reply to: Anonymous

Since AutoLISP runs in the document namespace, its scope is limited to the active drawing, and any program running in the active drawing will cease evaluation when that drawing is no longer active.

 

To operate on multiple drawings you would need to either use an AutoCAD Script or ObjectDBX; for a beginner, I would advise the former suggestion, and would refer you to this post.

 

I hope this points you in the right direction.

 

Lee

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

Post to forums  

Autodesk Design & Make Report

”Boost