Inventor vb.net Documents.Open to open assembly with specific View Representation

Inventor vb.net Documents.Open to open assembly with specific View Representation

J_Dumont
Advocate Advocate
302 Views
2 Replies
Message 1 of 3

Inventor vb.net Documents.Open to open assembly with specific View Representation

J_Dumont
Advocate
Advocate

I have a vb.net program that opens a specific file using the below code.

            g_inventorApplication.Documents.Open(tbNewProjectFolderName.Text + "\" + "iBar Grille.iam", True)

Unfortunately, the file opens with the "Primary" View Representation even though the file was saved with another.

 

0 Likes
Accepted solutions (1)
303 Views
2 Replies
Replies (2)
Message 2 of 3

nstevelmans
Advocate
Advocate
Accepted solution

Hi, you can run  this after opening the assembly

 

--------------------------------------------------------------------------------------

Private Sub SetDesignView(Name As String) 'designview name
Dim oAssyDoc As AssemblyDocument = _inventorApplication.ActiveEditDocument
Try
Dim oAssyCompDef As AssemblyComponentDefinition = oAssyDoc.ComponentDefinition
Dim oRepresman As RepresentationsManager = oAssyCompDef.RepresentationsManager
Dim oDesignview As DesignViewRepresentation = oRepresman.DesignViewRepresentations.Item(Name)
If oDesignview IsNot Nothing Then
oDesignview.Activate()
End If
Catch ex As Exception

End Try
End Sub

---------------------------------------------------------------------------------------------------

 

 

If a response answers your question, please use  ACCEPT SOLUTION  to assist other users later.

Also be generous with Likes!  Thank you and enjoy!

Message 3 of 3

J_Dumont
Advocate
Advocate

Thank you so much.

Shortly after submitting my post, I thought the same thing, but your code saved me so much time.

 

0 Likes