Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Darkforce_the_ilogic_guy
407 Views, 2 Replies

Clear Overide on all Conponent(first level ) on assambly

I have this code .. I keep getting an error .. that I want the code to

do is to cleal override the component in the assembly on all view... I have a code that do the same for part... that work ... I have a code the can add an colour to the component or part ... but I like to make the code needed to remove the colour again after add them to the part and assembly ... only thing that I can not get to work jet is the assembly  clearsoverride.. see the code I have so far below

 

 

 Dim oAsmCompDef 'As AssemblyComponentDefinition

 
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
 
 Dim oViewReps As DesignViewRepresentations
oViewReps = oAsmCompDef.RepresentationsManager.DesignViewRepresentations


'define view rep
Dim oViewRep As DesignViewRepresentation


Dim NumberOfView = oViewReps.Count
' get Manager of Representations

 Dim dViewRepMgr As RepresentationsManager
 dViewRepMgr = oAsmCompDef.RepresentationsManager

 'Get active Representation View
 Dim dViewRep As DesignViewRepresentation
 dViewRep = dViewRepMgr.ActiveDesignViewRepresentation

 
 

For i = 1 To NumberOfView
 If iProperties.Value("Custom", "Surface") = "Raw" Or iProperties.Value("Custom", "Surface") = "Galv." Or iProperties.Value("Custom", "Surface") = "Colour 1" Or iProperties.Value("Custom", "Surface") = "Colour 2" Or iProperties.Value("Custom", "Surface") = "RAL 5003" Or iProperties.Value("Custom", "Surface") = "RAL 9010" Or iProperties.Value("Custom", "Surface") = "RAL 1028" Or iProperties.Value("Custom", "Surface") = "RAL 9005"  Or iProperties.Value("Custom", "Surface") = "EG-Galv" Or iProperties.Value("Custom", "Surface") = "HDG-Galv"  Then

oViewReps.Item(i).Activate
End If

'---------------------
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisDoc.Document
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oAsmDoc.ComponentDefinition

Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences


oAsmCompDef.ClearAppearanceOverrides(oOccurrence.name)
 
 iLogicVb.UpdateWhenDone = True

Next

'-------------------------
iLogicVb.UpdateWhenDone = True

Next

 

 

 

Tags (2)