Hi,
I am an ActiveX learner and I have a little problem.
** Assuming: More than one document is opened.
If "drawing1" is the ActiveDocument, then I want to Activate "drawing2" as ActiveDocument and send some commands to newly activated (drawing2) document.But my program does not work correctly.It will be very helpful if you rectify this program with proper explanation.
Thanks,
Rajat
Kolkata
India
Here is my program:
Code:
; ** More than one document must exists.
(defun xx (/ app documents dc docs doc mspace)
(vl-load-com)
(setq app (vlax-get-acad-object))
(setq documents (vla-get-Documents app))
(vlax-for dd documents (setq docs (cons dd docs)))
(setq doc (vla-get-activedocument app)) ; Get current ActiveDocument.
(if(equal doc (nth 0 docs))(setq dc (nth 1 docs))(setq dc (nth 0 docs))) ; Find another document which is not ActiveDocument.
(vla-put-activedocument app dc) ; Specify document "dc" as ActiveDocument ;
(setq doc (vla-get-activedocument app)) ; Get current ActiveDocument.
(setq mspace (vla-get-ModelSpace doc)) ; Get Current ActiveDocument's ModelSpace.
(vla-addcircle mspace (vlax-3d-point '(3.0 3.0 0.0)) 10) ; Add circle in the Active ModelSpace.
(vla-ZoomExtents app) ; Zoom in the current viewport.
(princ)
)