Issue:
An update to an older post on this topic:
An update to an older post on this topic:
Solution:
You can use this example iLogic rule to traverse the assembly (and subassemblies) to turn off all work features and sketches.
SubMain
DimoDocAsAssemblyDocument = ThisApplication.ActiveDocument
DimoOccsAsComponentOccurrences = oDoc.ComponentDefinition.Occurrences
DimsNameAsString
sName = oDoc.DisplayName
'set vis in the top level
CallSetVis(oDoc, sName)
CallTraverseAssembly(oOccs)
EndSub
SubTraverseAssembly(oOccsAsComponentOccurrences)
DimoOccAsComponentOccurrence
ForEachoOccInoOccs
DimoDocAsDocument
oDoc = oOcc.Definition.Document
DimsNameAsString
sName = oOcc.Name
'set vis in the component
CallSetVis(oOcc.Definition.Document, sName)
'if sub assembly step into it's Occurrences collection
IfoOcc.DefinitionDocumentType = _
DocumentTypeEnum.kAssemblyDocumentObjectThen
Logger.Info("Stepping into: "& sName)
oSubOccs = oDoc.ComponentDefinition.Occurrences
CallTraverseAssembly(oSubOccs)
EndIf
Next
EndSub
SubSetVis(oDocAsDocument, sNameAsString)
DimoDefAsComponentDefinition
oDef = oDoc.ComponentDefinition
ForEachoItemInoDef.Workplanes
Try
oItem.visible = False
Catch
Logger.Info("Could not set work plane vis for: "& sName)
EndTry
Next
ForEachoItemInoDef.WorkAxes
Try
oItem.visible = False
Catch
Logger.Info("Could not set work axis vis for: "& sName)
EndTry
Next
ForEachoItemInoDef.WorkPoints
Try
oItem.visible = False
Catch
Logger.Info("Could not set work point vis for: "& sName)
EndTry
Next
ForEachoItemInoDef.Sketches
Try
oItem.visible = False
Catch
Logger.Info("Could not set sketch vis for: "& sName)
EndTry
Next
EndSub