Afternoon,
I am in a bit of a pinch here and need some help.
I have a bunch of drawings created from several different sources. The problem I am having is that some of these drawings have a model drawn in model space and text in paper space, others have the model and text in paper space and there is no viewport or everything in Model space and there is no viewport. In this case, sometimes there is the default "layout" tab and at other times there is a name to the layout tab even though there is no viewport attached to it.
I need to find a generic way of finding out what the drawing is like.
The only thing I can think of at the moment is searching for a viewport, so I'm using Mark's code:
(vlax-for Lyout (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (eq :vlax-false (vla-get-modeltype Lyout)) ; if layout is other than Model
(vlax-for Ent (vla-get-block Lyout) ; for each entity in layout
(if (= (vla-get-objectname Ent) "AcDbViewport") ; if there is a viewport
(setq dwgVP 1)
(setq dwgVP nil)
< .. >
But my variable 'dwgVP' is coming up nil every time.
So can you kill two birds with one stone here? I mean, I have done a search for "find viewport" and "search for viewport" but have come up empty. So the question(s) here are; How do I go about searching for a viewport in the drawing? I do have a few drawings where there are several tabs, and a drawing on each one with nothing in model space and no viewports, but a lot of tabs with different names so I can't search by a named tab.
And my second question would be; Do you have a suggestion to better determine if the drawing has a viewport and if so, how many, and on what tabs, and ... what else can be added to this can of worms?
Thanks.