Hello!
I am trying to hide (turn off visibility for) parts of assemblies and subassemblies when I am making drawings drafts. The parts that need to be hidden based on their names, like "screws" and "bolt". I would also need to access subassemblies and I believe I do that by calling a subfunction.
I think I am having trouble accessing the DrawingView type or at least taking data from this type. I am trying to use .contain() but unsure how to convert the DrawingView or AssemblyDocument to string.
Also- Anyone know a website to see a complete list of things I can do to each types?
Sub Main()
'Selecting a view; the result is VIEW1
Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select view")
'Trying to extract an assembly from this VIEW
Dim oAssembly As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
'Defining oComp to contain components
Dim oComp As ComponentOccurrence
'Hiding the components
For Each oComp In ThisApplication.ActiveDocument.ComponentDefinition.Occurrences
name = UCase(assembly.Name)
If oComp.name.Contains("SCREW") Or name.Contains("NUT") Or name.Contains("WASHER") Then
oComp.Visible = False
MsgBox("test1")
Else
MsgBox("test2")
End If
next
End Sub
Thanks!
Jamin
Solved! Go to Solution.
Link copied