"Set As Front" Command for View in Drawing.

"Set As Front" Command for View in Drawing.

C_Haines_ENG
Collaborator Collaborator
592 Views
5 Replies
Message 1 of 6

"Set As Front" Command for View in Drawing.

C_Haines_ENG
Collaborator
Collaborator

This is a very weird process, but I would like to be able to select a view and have its "Front" in the view cube changed to overwrite whatever direction its looking.

 

We extract the parts from an overall part and thus some parts don't always get their correct view orientation correct, so I could select a view and it would update the default "Front" view to replace whatever view was there before.

 

I have a feeling this is not possible though but if it is it would save me hours of work. 

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

Michael.Navara
Advisor
Advisor

If I understand well, you want to update viewcube orientation in model by the drawing view?

0 Likes
Message 3 of 6

Michael.Navara
Advisor
Advisor
Accepted solution

Is this what you are looking for?

 

'Pick drawing view
Dim pick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select drrawing view")
Dim drwView As DrawingView = pick

'Get camera of selected drawing view
Dim drwViewCamera As Camera = drwView.Camera

'Get referenced model
Dim modelDoc As Document = drwView.ReferencedDocumentDescriptor.ReferencedDocument

'Get model view (first or new one) and its camera
Dim modelView As Inventor.View
If modelDoc.Views.Count = 0 Then
    modelView = modelDoc.Views.Add()
Else
    modelView = modelDoc.Views(1)
End If


'Copy camera from drwaing view to model view
Dim modelViewCamera As Camera = modelView.Camera
modelViewCamera.Eye = drwViewCamera.Eye
modelViewCamera.Target = drwViewCamera.Target
modelViewCamera.UpVector = drwViewCamera.UpVector

'Apply camera to model view
modelViewCamera.ApplyWithoutTransition()

'Apply ViewCube orientation
Dim activeView = ThisApplication.ActiveView
modelView.Activate()
modelView.SetCurrentAsFront()
activeView.Activate()

 

Message 4 of 6

C_Haines_ENG
Collaborator
Collaborator

This works great! Is it possible for it not to open the part separately or at least do it hidden?

0 Likes
Message 5 of 6

Michael.Navara
Advisor
Advisor

Yes, finally you can call. 

 

modelView.Close()

But the modelView must be the active view, when you call SetCurrentAsFront method.

 

 

0 Likes
Message 6 of 6

C_Haines_ENG
Collaborator
Collaborator

Fantastic!

0 Likes