manipulating drawing views

manipulating drawing views

GilesPhillips
Collaborator Collaborator
605 Views
4 Replies
Message 1 of 5

manipulating drawing views

GilesPhillips
Collaborator
Collaborator

Hi All,

 

I have a series of drawings consisting of a 3d object in modelspace and several paperspace layouts with drawing views of the 3d model on them.

I wish to ultimately export the drawings views to another file, as regular autocad entities (as part of a batch), in essence recreating the exportlayout command, but without the prompting, and also applying a bit of filtering of irrelevant data.

I'm struggling to find any way of interacting with the Drawing View objects in paperspace through VBA, a scan of entities on a paperspace layout will yield an IAcadViewBorderWrapper object, but with little I can do with it - it doesn't even appear in the standard type list:

 

GilesPhillips_0-1642077478512.png

 

 

Likewise a rummage through the block definitions will show some anonymous blocks with the prefix "*S" but figuring out which is the one I want is challenging without further information.
I'm guessing there might be some form of extension dictionary or something that  links this stuff up, but I'm not sure how to find it.

Does anyone have any clues, or can share their own experimental results?

cheers

 

G

ACad, MEP, Revit, 3DS Max
0 Likes
606 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor

I guess people hesitate to respond because the term "drawing views" is quite confusing: what object/class in the AutoCAD's COM API model is it?

 

From your description, it seems to me that what you refer to is the PaperSpace viewport on layout. That is, you want to identify all entities in ModelSpace that are visible in a given Viewport on a given Layout. Once you identify these entities, you can then move/copy/export them to somewhere/another drawing (this would be different work beyond your question). 

 

If that is what you want, then you just simply find out a window/boundary in the ModelSpace that is corresponding to the said Viewport. Assume the viewport is an rectangle, then you only need to find the viewport corners' coordinates and transform them into coordinates in ModelSpace. Once you get the window/boundary in ModelSpace, you can use whatever algorithm to detect which entities is inside the boundary. There are quite a few discussions in this forum on how to get the area in ModelSpace corresponding to PaperSpace viewport or vice versa, such as this latest one:

 

https://forums.autodesk.com/t5/vba/create-viewport-from-rectangle-or-block/td-p/10734474 

 

Not sure if I understood your question correctly.

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 5

GilesPhillips
Collaborator
Collaborator

Hi Norman, thanks for your reply..

 

This isn't a Viewport in the traditional sense - it's a paperspace drawing view derived from 3d geometry in modelspace.  They behave in a manner similar to block references to the user interface, however they are not editable like a block.

They can sometimes be referred to as Base View or Projected View within the model documentation objects described in the help files:

 

https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/AutoC...

 

As far as the COM API object references are concerned, I don't really have much more beyond what's already stated:

 

VBA sees them as an IacadViewBorderWrapper when explored through the watch window on the VBA IDE

 

There doesn't seem to be a way of interacting with it within VBA - I cannot create or reference  a type IacadViewBorderWrapper in my code - which makes me wonder if I need to reference and additional type library - but which one?

 

Does this clarify?

 

regards

 

G

ACad, MEP, Revit, 3DS Max
0 Likes
Message 4 of 5

norman.yuan
Mentor
Mentor

Ah, learned something new. Never worked with Inventor, and almost no solid/3d model experience. But I am pretty sure AutoCAD COM API used by VBA does not have support to it. If you do .NET API, I think there is corresponding class you would work with:

 

Autodesk.AutoCAD.GraphicsSystem.View

 

But I do not know if the API with that class can do what you want or not. If you are interested in possible solution in .NET API solution, you may want to post question in .NET forum.

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5

GilesPhillips
Collaborator
Collaborator
Thanks Norman - I guess every day is a school day 🙂

I have been considering dipping a toe in the .NET environment, but it's a bit of a shift from fast and loose approach that VBA allows, I might have to get organised and code properly!
ACad, MEP, Revit, 3DS Max
0 Likes