Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drawing View Perspective

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
odilon_b87
984 Views, 4 Replies

Drawing View Perspective

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

4 REPLIES 4
Message 2 of 5
WCrihfield
in reply to: odilon_b87

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.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
  • Create DocumentSubTypeEnum Click Here
  • Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5
odilon_b87
in reply to: WCrihfield

Thank you, this solution worked a treat.

Message 4 of 5

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

Message 5 of 5

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

EESignature

(Not an Autodesk Employee)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report