Hello,
In most of my drawings, I have one isometric drawing view that needs to be shaded and put into a perspective view. I am able to isolate the drawing view and shade it but I can't for the life of me find a way to change it into perspective view. I've tried using cameras, but it only seemed to change the whole sheet into perspetive view. Can anyone shed some light on how I would be able to change one particular drawing view into perspective if its even possible?
Thanks, Odi
Here's my code so far
For Each oSheet In DFDoc.Sheets
For Each oView In oSheet.DrawingViews
If oView.ViewType = 10504 And oView.ViewOrientationFromBase = False Then
oView.ViewStyle = DrawingViewStyleEnum.kShadedDrawingViewStyle
'CODE: Change drawing view from orthographic to perspective
End If
Next
Next
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Try it this way.
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oCDs As ControlDefinitions = ThisApplication.CommandManager.ControlDefinitions
Dim oOType As ViewOrientationTypeEnum
For Each oSheet As Sheet In oDDoc.Sheets
For Each oView As DrawingView In oSheet.DrawingViews
oOType = oView.Camera.ViewOrientationType
If oOType = ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation Or _
oOType = ViewOrientationTypeEnum.kIsoBottomRightViewOrientation Or _
oOType = ViewOrientationTypeEnum.kIsoTopLeftViewOrientation Or _
oOType = ViewOrientationTypeEnum.kIsoTopRightViewOrientation And _
oView.ViewOrientationFromBase = False Then
oView.ViewStyle = DrawingViewStyleEnum.kShadedDrawingViewStyle
oDDoc.SelectSet.Clear
oDDoc.SelectSet.Select(oView)
oCDs.Item("DrawingViewEditCtxCmd").Execute
oCDs.Item("DrawingBaseViewCubePersp").Execute
oCDs.Item("AppContextual_OKCmd").Execute
End If
Next
Next
I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.
Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.
Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield
(Not an Autodesk Employee)
Do you mean that this code chnage the IsoView to a true perspactive one?
is it possible to change a custom view saved in the design Area too?
and if yes, how do you play those lines of code?
Many Thanks
Hi @jean-michel_legoff. Are you just trying to toggle the [Orthographic/Perspective/Perspective with Ortho Faces] setting within a normal model (part or assembly) view (not a view in a drawing)? If so, I know of two or three ways to do it manually, but honestly haven't ever tried doing it by code, because I simply never had the need to.
However, here are the only 6 command names I could find related to this action.
AppOrthographicCameraCmd
AppPerspectiveCameraCmd
AppPerspectiveOrthoCameraCmd
AppViewCubeOrthographicCmd
AppViewCubePerspectiveCmd
AppViewCubePerspectiveOrthoCmd
And here is an iLogic rule example that attempts to use execute one of them to perform the action.
oView = ThisApplication.ActiveView
oPerspectiveOn = oView.Camera.Perspective
oCDs = ThisApplication.CommandManager.ControlDefinitions
oOrthoCam = oCDs.Item("AppOrthographicCameraCmd")
oPerspectiveCam = oCDs.Item("AppPerspectiveCameraCmd")
oPerspectiveOrthoCam = oCDs.Item("AppPerspectiveOrthoCameraCmd")
oVCubeOrtho = oCDs.Item("AppViewCubeOrthographicCmd")
oVCubePerspective = oCDs.Item("AppViewCubePerspectiveCmd")
oVCubePerspectiveOrtho = oCDs.Item("AppViewCubePerspectiveOrthoCmd")
'example of executing one of them
oPerspectiveCam.Execute
If this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.