sketch visibility of part in assembly using vba

sketch visibility of part in assembly using vba

Anonymous
Not applicable
894 Views
3 Replies
Message 1 of 4

sketch visibility of part in assembly using vba

Anonymous
Not applicable

how to turn off the visibility of a specific sketch (ex. base_Sketch) of a certain part in assembly using vba?

 

 

0 Likes
895 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
0 Likes
Message 3 of 4

Anonymous
Not applicable
i know how to access a sketch in a part , what i need to figure out is how to access a sketch in a part from assembly using vba.

anyone ????
0 Likes
Message 4 of 4

Vladimir.Ananyev
Alumni
Alumni

Here is VBA snippet:

 

  Dim oAsmDoc As AssemblyDocument
  Set oAsmDoc = ThisApplication.ActiveDocument
  
  'get the reference to the desired component by its name
  Dim oOcc As ComponentOccurrence
  Set oOcc = oAsmDoc.ComponentDefinition.Occurrences.ItemByName("AAA")
  
  'assume this is a part (not subassembly)
  Dim oDef As PartComponentDefinition
  Set oDef = oOcc.Definition
  
  'get the reference to the sketch by its name
  Dim oSketch As Sketch
  Set oSketch = oDef.Sketches.Item("Sketch2")
  
  'make sketch invisible
  oSketch.Visible = False

 cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes