Activate the "Master" view of a part

Activate the "Master" view of a part

w.pepping
Advocate Advocate
460 Views
1 Reply
Message 1 of 2

Activate the "Master" view of a part

w.pepping
Advocate
Advocate

I have a macro to change the thumbnails of a part, but my parts have not always the "Master view" active. 

How can I activate a view by code?

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes
Accepted solutions (1)
461 Views
1 Reply
Reply (1)
Message 2 of 2

Vladimir.Ananyev
Alumni
Alumni
Accepted solution

Could you try this sample code:

Sub Part_Switch2ViewMaster()
  Dim oDoc As PartDocument
  Set oDoc = ThisApplication.ActiveDocument
  
  Dim oDef As PartComponentDefinition
  Set oDef = oDoc.ComponentDefinition
  
  Dim oRepMgr As RepresentationsManager
  Set oRepMgr = oDef.RepresentationsManager
  
  Dim oViewReps As DesignViewRepresentations
  Set oViewReps = oRepMgr.DesignViewRepresentations
  
  Dim oView As DesignViewRepresentation
  Set oView = oRepMgr.ActiveDesignViewRepresentation
  MsgBox (oView.Name)
  
  Set oView = oViewReps.Item("Master")
  oView.Activate
  MsgBox (oView.Name)

End Sub

 cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes