Rotate Drawing View with Included Sketch Crashes

Rotate Drawing View with Included Sketch Crashes

johnster100
Collaborator Collaborator
860 Views
5 Replies
Message 1 of 6

Rotate Drawing View with Included Sketch Crashes

johnster100
Collaborator
Collaborator

Hi,

I am trying to rotate a drawing view using iLogic. This works fine when the view has no sketches included, but crashes when include a sketch. I am using Inventor 2019.4.9.

 

I have attached a simple drawing showing the crash. (rule 1 rotates the view without the sketch, rule 2 crashes on the drawing view with the sketch).

 

Is there any workaround to this issue?

 

thanks,

John

0 Likes
Accepted solutions (1)
861 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor
Accepted solution

Hi @johnster100.  Simple, yet interesting case.  After trying both the DrawingView.RotateByAngle() method and simply trying to set an angle to the DrawingView.Rotation property, and both failed, I decided to try it manually, which finally worked, interestingly enough.  So, I stated looking into a way to automate that manual process by code.  The simplest way I know how is to execute the same command that the manual tool uses, then use the SendKeys.SendWait() method to simulate navigating the dialog by keyboard interaction.  Here is the code routine that worked to rotate the view by 90 degrees for me.  This is of course a last resort solution, and is most likely not the most stable way to do it.  And I'm not sure if the needed order of operations, as far as keyboard interaction, will work for everyone either.  If not, it may take a little trial an error testing, by doing it manually using the keyboard, recording what keys you had to use, then putting that into the code.

oView = ActiveSheet.View("VIEW2").View
Dim oDDoc As DrawingDocument = oView.Parent.Parent
oSS = oDDoc.SelectSet
oSS.Clear
oSS.Select(oView)
oCD = ThisApplication.CommandManager.ControlDefinitions.Item("DrawingViewRotateCtxCmd")
oSS.Select(oView)
oCD.Execute2(False)
AppActivate(ThisApplication.Caption)
System.Windows.Forms.SendKeys.SendWait("{DOWN}^A90{TAB}{UP}{ENTER}")

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

johnster100
Collaborator
Collaborator

Hi,

thanks for the reply.

 

I ended up making my sketches into surfaces and including them, which worked as they were simple sketches.

 

thanks,

John

Message 4 of 6

ch_giacomo
Enthusiast
Enthusiast
hello it is possible to modify the rule so that the view rotates and sets on the Home view of the Cube
Thank you
0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor

Hi @ch_giacomo.  Here is a similar simple iLogic rule you can use to change the view's orientation to a specific one.  There are many variations of that ViewOrientationTypeEnum to choose from.

 

Dim oView As DrawingView = ActiveSheet.View("VIEW1").View
oView.Camera.ViewOrientationType = ViewOrientationTypeEnum.kIsoTopRightViewOrientation
oView.Camera.Apply

 

But keep in mind that you may only be able to do this to a 'Base' type view, not a projected view, because projected views have their orientation dictated by the view they are being projected from.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 6

ch_giacomo
Enthusiast
Enthusiast

Thank you so much.. perfect what I needed..

0 Likes