TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: daron on October 17, 2003, 12:11:20 PM
-
Will someone please try this out and let me know if it works for them. I can't get it to work. I've followed The VisuaLisp's Developer's Bible and besides taking out the counting feature in Dave's rendition, I can't seem to figure out why I can't get it to work. Speaking of Dave, does anybody think he'd be interested in joining this board?
(defun c:zea ()
(vla-StartUndoMark (vla-get-activedocument (vlax-get-acad-object)))
;(deselect) not necessary
(setq $acad (vlax-get-acad-object)
alldocs (vla-get-documents $acad)
this (vla-get-activedocument $acad)
)
(defun ZoomExtents ()
(vla-put-ActiveDocument each);|<-Doesn't this pick up the object when it's run under vlax-for?|;
(vla-ZoomExtents $acad)
(vla-put-ActiveDocument this)
(vlax-release-object $acad)
(vlax-release-object alldocs)
)
(vlax-for each alldocs
(if (= (vla-get-ActiveSpace each) 0) ; If in paperspace
(cond
((and (= (vla-get-MSpace each) :vlax-True)
; in mspace viewport
(= (vla-get-DisplayLocked
(vla-Get-ActivePViewport each)
)
:vlax-True
) ; Mspace viewport is locked
)
(vla-put-MSpace each :vlax-False)
(ZoomExtents)
(vla-put-MSpace each :vlax-True)
)
((and (= (vla-get-MSpace each) :vlax-True)
; in mspace viewport
(= (vla-get-DisplayLocked
(vla-Get-ActivePViewport each)
)
:vlax-False
) ; Mspace viewport is not locked
)
(ZoomExtents)
)
((= (vla-get-MSpace each) :vlax-False)
(ZoomExtents)
)
)
(ZoomExtents)
)
)
(vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object)))
(princ)
)
-
Here are my initial thoughts. (I dont have a bunch of time untill lunch, but see if this helps)
This is the first part of your program.
(defun c:zea ()
(vla-StartUndoMark (get-active-document)) ;;<- needed function
(deselect) ;;<- needed function
(setq $acad (vlax-get-acad-object)
alldocs (vla-get-documents $acad)
this (vla-get-activedocument $acad)
)
(defun ZoomExtents ()
(vla-put-ActiveDocument each) ;;<- object needed
(vla-ZoomExtents $acad)
(vla-put-ActiveDocument this)
(vlax-release-object $acad)
(vlax-release-object alldocs)
)
...
-
I've modified the original code. It still isn't working.
-
What is the purpose of this code? At a quick glance, it looks like hes trying to zoom extents each drawing in the collection.
*Quick thoughts*
-Whats the modelspace for? Is he trying to zoom extents modelspace and not paperspace?
-What is the reference to the viewport for?
Alright, ill look into this code for ya. give me a sec.
-
You ever have a locked viewport while in paperspace and you use (vla-zoomextents (vlax-get-acad-object))? Does it care if the vport is locked? No. That's what all the extra code is for. And yes, I am trying to zoom extents all open drawings regardless of space.