PDA

View Full Version : vla-addLightweightPolyline PaperSpace/Layout


pnorman
2005-05-25, 12:14 AM
Please help...

How do I tell vla-addLightweightPolyline which paper space layout to draw the polyline in. I want to add the pl in the current layout regardless of whether its "Model" or one of multiple p/s layouts.

The code below only puts the polyline in the first paper space layout regardless of which p/s layout is actually current.
What am I missing?
Do I need to add the polyline and then change its layout property using vla-put- or is there an easier way to tell vla-addL.... which layout is current?

The second p/s code fragment below doesn't work at all!!
(the model space works fine in all cases)


(if (= (getvar "CTAB") "Model")
(setq OBJ (vla-addLightweightPolyline (model-space) SA1))
(setq OBJ (vla-addLightweightPolyline (paper-space) SA1))
)

(defun acad-object ()
(cond (*acad-object*) ; Return the cached object
(t
(setq *acad-object* (vlax-get-acad-object))
)
)
)

(defun active-document ()
(cond (*active-document*) ; Return the cached object
(t
(setq *active-document* (vla-get-activedocument (acad-object)))
)
)
)

(defun model-space ()
(cond (*model-space*) ; Return the cached object
(t
(setq *model-space* (vla-get-modelspace (active-document)))
)
)
)

(defun paper-space ()
(cond (*paper-space*) ; Return the cached object
(t
(setq *paper-space* (vla-get-paperspace (active-document)))
)
)
)




(if (= (getvar "CTAB") "Model")
(setq OBJ (vla-addLightweightPolyline (model-space) SA1))
(setq OBJ (vla-addLightweightPolyline (vla-get-ActiveLayout (active-document)) SA1))
)


Thanks

pnorman
2005-05-25, 01:06 AM
Forget it. I have found my error.
It was in the declaration of the variable *paper-space*.
By making it global it was not being reset after layout changes and as there is only one model space I never had the problem before.

Cheers
P