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

List of Drawings from one drawing to the next.

1 REPLY 1
Reply
Message 1 of 2
kpennell
279 Views, 1 Reply

List of Drawings from one drawing to the next.

I used to think it was possible through lisp, but I don't think so.

 

I know there is ScriptPro, but for some reason, I do find it cumbersome.

 

I have the following string of code, that I'll write in everyone's start-up suite.  Thanks to DosLib, I'm able to retrieve a list of files I want to modify, for whatever reason.  (One example, when plotting drawings with layouts, sometimes the shadeplot setting is wireframe, and not classic hidden, though it's been set up in our templates).

 

The huge question is, can I get a list of drawings to a variable in one drawing, and have access to that variable list, in the next drawing I open?  I'll iron out the bugs on read-only statuses, or manipulating drawing states later.

 

Thanks

KP

 

; see code below

 

(defun GetDrawings ()

(setq currentpath (getvar "dwgprefix"))

(command "pspace")

(setq DrawingList (dos_getfilem "Select a file" currentpath "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||"))

(setq ListOfDrawings (cdr DrawingList))

(setq DrawingPath (nth 0 DrawingList))

(Alert DrawingPath); just making sure what I'm looking for is what gets returned

(Alert (itoa (length ListOfDrawings))); just making sure what I'm looking for is what gets returned

(princ ListOfDrawings); just making sure what I'm looking for is what gets returned

(setq Element 0)

(setq OpenDrawing (nth Element ListOfDrawings))

(setvar "filedia" 0)

(command "save" "")

(command "open" OpenDrawing)

)

 

(defun ScriptInDrawing (/)

(cond

((= DrawingList nil)(GetDrawings))

(T())

)

(setq Element (+ Element 1))

(setq OpenDrawing (nth Element ListOfDrawings))

(command "line" "0,0" "11,11" ""); or some test to see that this works  (command "save" "")

(command "open" OpenDrawing)

(princ))

 

(defun C:copen (/)

(ScriptInDrawing)

)

 

(defun C:aopen (/)

(cond

((= DrawingList nil)(Alert "NIL?"))

(T(ScriptInDrawing))

);T

);defun

 

(C:AOPEN)

1 REPLY 1
Message 2 of 2
pbejse
in reply to: kpennell

look into vl-propagate 

 

(setq lst '("drawing1.dwg" "drawing2.dwg" "drawing3.dwg"))
(vl-propagate 'lst)

 

HTH

 

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report