Insert a base view with the same 3D model orientation via API

Insert a base view with the same 3D model orientation via API

vincenzobYFDD6
Explorer Explorer
122 Views
1 Reply
Message 1 of 2

Insert a base view with the same 3D model orientation via API

vincenzobYFDD6
Explorer
Explorer

Good morning everyone, is there a way to insert a base view into a drawing with the same orientation as the 3D model via API in VBA or C#?  So far, I've only been able to create a base view with the default orientation.

 

3D MODEL

vincenzobYFDD6_3-1738843505836.png

 

BASE VIEW

vincenzobYFDD6_2-1738843266081.png

 

 

 

0 Likes
123 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @vincenzobYFDD6.  I am not sure what 'Retro' (in the ViewCube) means, but I assume that would be 'Back' in English, and it looks like it is upside-down (rotated 180 degrees) also.  Since there is no variation of the ViewOrientationTypeEnum that is both for both 'Back' (kBackViewOrientation) and 180 degrees rotated at the same time, you will have to do this another way, which will require a bit more code.  When using the DrawingViews.AddBaseView method, there is an 'Optional' input parameter named 'AdditionalOptions', which is asking for a NameValueMap.  The documentation for that method shows what we can put into that NameValueMap, and we will need to use two of those ('DesignViewRepresentation' & 'DesignViewAssociative').  The documentation says those only apply when the model in the view is an assembly, but they should work for a part also, since they have them also.  But if using the NameValueMap and those options does not work, then we will have to specify those two settings after the view has been placed, by changing the view to the way we want it later.  If changing the view after it has been placed, we can use the DrawingView.SetDesignViewRepresentation method.  The idea is to specify the DesignViewRepresentation that you created within the model when you were looking at the model from that direction and orientation.  That representation will contain a 'saved' camera, that we will have to use.  And to use it, we will set the DrawingView.Camera.ViewOrientationType property's value to the 'kSavedCameraViewOrientation' variation of the ViewOrientationTypeEnum.  Then use the DrawingView.Camera.Apply method, to apply that change to the view's camera.  That should cause the DrawingView to look at the model the same way that DesignViewRepresentation was.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes