TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: rhino on December 30, 2009, 12:15:10 AM
-
Hello all & Complements of the season!
I'm looking for a way that will let me run a LISP across all open drawings -
I like the way this routine works; but can't seem to get it to work for the purpose I need
http://www.theswamp.org/index.php?topic=30704.msg362918#msg362918
-
Will this work for you?
(defun c:sample ( / OpenDwgs eachDwg)
(setq OpenDwgs (vla-get-documents (vlax-get-acad-object)))
(vlax-for eachDwg OpenDwgs
(do_some_stuff)
) ;_ end vlax-for
) ;_ end defun
/it's early in the morning, I haven't had my coffee, and I haven't actually tested the above for correctness but I'm pretty sure it's what you're after
-
Example:
(defun atedit (blk lst / dwg lay obj att tag)
(vl-load-com)
(mapcar 'set '(blk lst)
(list (strcase blk)
(mapcar (function (lambda (x) (list (strcase (car x))
(cadr x) (caddr x)))) lst)))
(vlax-for dwg (vla-get-Documents (vlax-get-acad-object))
(vlax-for lay (vla-get-layouts dwg)
(vlax-for obj (vla-get-Block lay)
(if (and (eq "AcDbBlockReference" (vla-get-ObjectName obj))
(eq (vla-get-HasAttributes obj) :vlax-true))
(foreach att (vlax-invoke obj 'GetAttributes)
(if (and (setq tag (assoc (strcase (vla-get-TagString att)) lst))
(eq (vla-get-TextString att) (cadr tag)))
(vla-put-TextString att (caddr tag)))))))
(vla-regen dwg acAllViewports))
(princ))
(defun c:test ( )
(atedit "Block Name" '(("TAG1" "Old Value" "New Value")
("TAG2" "Old Value" "New Value")))
(princ))
-
Will this work for you?
(defun c:sample ( / OpenDwgs eachDwg)
(setq OpenDwgs (vla-get-documents (vlax-get-acad-object)))
(vlax-for eachDwg OpenDwgs
([color=red]command "_zoom" "e"[/color])
) ;_ end vlax-for
) ;_ end defun
/it's early in the morning, I haven't had my coffee, and I haven't actually tested the above for correctness but I'm pretty sure it's what you're after
unfortunately it does not cycle through the open drawings as its required to...
-
It does, but you cannot use "command" calls in documents other than the active one.
-
It does, but you cannot use "command" calls in documents other than the active one.
umm so whats the work around?
a call to lisp function? - can that have calls to "command"?
I need it to do simple batch plot thingy that plots all open drawings in modelspace with extents
appreciate the help :)
-
The workaround is
(vla-ZoomExtents <app>)
But I believe this too will only work on the active Document. - a discussion here:
http://discussion.autodesk.com/forums/message.jspa?messageID=1184966 (http://discussion.autodesk.com/forums/message.jspa?messageID=1184966)
-
The workaround is
(vla-ZoomExtents <app>)
But I believe this too will only work on the active Document. - a discussion here:
http://discussion.autodesk.com/forums/message.jspa?messageID=1184966 (http://discussion.autodesk.com/forums/message.jspa?messageID=1184966)
I think i can use the code posted here:
http://discussion.autodesk.com/forums/thread.jspa?threadID=453185
-
unfortunately it does not seem to work :-o
so what about the VB or .net code anyone have a solution?
The program I require is similar to this posted by Tim http://www.theswamp.org/index.php?topic=31091.msg366740#msg366740 - but required for printing from modelspace with extents selected.