Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
steveh3
in reply to: steveh3

Gang...

Thanks for all the insight. So here's where I ended up and will share the logic....

 

Creates new View Rep and turns off all reference components at that level. Then activates the original View Rep when the iLogic was initiated....

 

' Creates a new View Rep "Active Components" and then turns all Reference Components visibility to off.
'It only turns On active Components at this level.
'Then returns back to original active View Rep when logic was initiated.



Dim odoc As Document
Dim oCompDef As ComponentDefinition
odoc = ThisApplication.ActiveDocument
oCompDef = odoc.ComponentDefinition


'Sets initial View Rep
oActiveViewRep = oCompDef.RepresentationsManager.ActiveDesignViewRepresentation



'Creates New View Rep
Dim oviewrep2 As DesignViewRepresentation
Try
oCompDef.RepresentationsManager.DesignViewRepresentations.Item("Active Components").Activate
Catch
 oviewrep2 = oCompDef.RepresentationsManager.DesignViewRepresentations.Add("Active Components")
End Try

'This turns off some object types in view rep
If odoc.DocumentType = kAssemblyDocumentObject Then
  ThisApplication.ActiveDocument.ObjectVisibility.WeldmentSymbols = False 
  'ThisApplication.ActiveDocument.ObjectVisibility.Welds = False
End If 



'This sets some parameters to turn off ref components 
oAssemblyComponents = oCompDef.Occurrences

Dim oOccurrence As ComponentOccurrence


    For Each oOccurrence In oAssemblyComponents
        If (oOccurrence.BOMStructure = BOMStructureEnum.kReferenceBOMStructure) Then
            oOccurrence.Visible = False
        Else
            oOccurrence.Visible = True
        End If
    Next

'Sets the view rep back to the one that was active before the rule was executed
oActiveViewRep.Activate 

 

Steve Hilvers
Inventor Certified User / Vault Professional Influencer