rotate view 1 su IDW

rotate view 1 su IDW

ch_giacomo
Enthusiast Enthusiast
630 Views
9 Replies
Message 1 of 10

rotate view 1 su IDW

ch_giacomo
Enthusiast
Enthusiast
Good morning everyone

I'm asking for help with a rule, but I'm stuck by my very little experience.

I got to this point:

 

 

' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    	oDrawDoc = ThisApplication.ActiveDocument 
        
    'Set a reference to the active sheet.
    Dim oSheet As Sheet
    	oSheet = oDrawDoc.ActiveSheet
		
		 ' Select a drawing view.
    Dim oDrawingView As DrawingView = ActiveSheet.View("VISTA1").View

 

 

 

and what I would like is to rotate the already existing "view 1" into an IDW and set it to the ViewGoHome, hope I made myself clear.

I attach the result

 

0 Likes
631 Views
9 Replies
Replies (9)
Message 2 of 10

Andrii_Humeniuk
Advisor
Advisor

Hi @ch_giacomo . This code changes the orientation of the camera:

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument 
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
Dim oCamera As Camera = oSheet.DrawingViews.Item(1).Camera
oCamera.ViewOrientationType = 10766
oCamera.Apply()

 ViewOrientationTypeEnum List 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

0 Likes
Message 3 of 10

ch_giacomo
Enthusiast
Enthusiast
thanks for the help but I get an error or made a screen

 

0 Likes
Message 4 of 10

Andrii_Humeniuk
Advisor
Advisor

Added check by view name "VISTA1". What version of the Inventor are you using?

 

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument 
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
Dim oCamera As Camera
For Each oView As DrawingView In oSheet.DrawingViews
	If oView.Name = "VISTA1" Then
		oCamera = oView.Camera
		oCamera.ViewOrientationType = ViewOrientationTypeEnum.kSavedCameraViewOrientation
		oCamera.Apply()
	End If
Next

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

0 Likes
Message 5 of 10

ch_giacomo
Enthusiast
Enthusiast
2019 VERSION

WITH THE NAME "VISTA1" IT GIVES ME AN ERROR

OR TRIED TO ENTER "VIEW1"
IT DOESN'T RETURN AN ERROR BUT THE RULE DOESN'T ROTATE THE VIEW, PRACTICALLY NOTHING HAPPENS AS YOU ROLL THE RULE.
0 Likes
Message 6 of 10

ch_giacomo
Enthusiast
Enthusiast

Maybe it's the first part I wrote that could be wrong?

' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    	oDrawDoc = ThisApplication.ActiveDocument 
        
    'Set a reference to the active sheet.
    Dim oSheet As Sheet
    	oSheet = oDrawDoc.ActiveSheet
		
		 ' Select a drawing view.
    Dim oDrawingView As DrawingView = ActiveSheet.View("VISTA1").View
0 Likes
Message 7 of 10

Andrii_Humeniuk
Advisor
Advisor

Check out this Link . I changed line 10, maybe that will help.

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument 
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
Dim oCamera As Camera
For Each oView As DrawingView In oSheet.DrawingViews
	If oView.Name = "VISTA1" Then
		oCamera = oView.Camera
		oCamera.ViewOrientationType = ViewOrientationTypeEnum.kSavedCameraViewOrientation
		oCamera.ApplyWithoutTransition
	End If
Next

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

0 Likes
Message 8 of 10

ch_giacomo
Enthusiast
Enthusiast
Thank you.
maybe I haven't been able to explain myself well.
I have many IDWs that have only one view "View1" and it is set differently between the various IDWs.. what I was looking for is by launching the rule that this view would be rotated as set in the "HOMEVIEWCUBE"

The link talks about a rule that changes the ViewCube... instead I'm talking about the view in the layout
0 Likes
Message 9 of 10

ch_giacomo
Enthusiast
Enthusiast

I found this rule that almost does the desired result... maybe this is an excellent starting point to modify it so that the view rotates as hoped:

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}")
0 Likes
Message 10 of 10

ch_giacomo
Enthusiast
Enthusiast
0 Likes