change color from IPT to change to reference in IAM

change color from IPT to change to reference in IAM

S_May
Mentor Mentor
721 Views
2 Replies
Message 1 of 3

change color from IPT to change to reference in IAM

S_May
Mentor
Mentor

Hello together,

 

I need an ilogic the components on the part list reference will be red, the reference will be removed the components again as the material

component = reference = red
component = normal = color as material

Trigger is the changeover to reference or from reference back

The rule in the appendix can be almost :-(, can make the ilogic someone please

Here is the rule and the Video inventor-ilogic-farbe-referenzierter-bauteile-andern

 

' set a reference to the assembly component definintion.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check occurence BOM Structure and component definition BOM Structure
If oOccurrence.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Or _
oOccurrence.Definition.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then
'set color
Component.Color(oOccurrence.Name) = "Red"
End If
Next

 

 

thx @GÖÖÖ and @kurtis

 

Accepted solutions (1)
722 Views
2 Replies
Replies (2)
Message 2 of 3

b_sharanraj
Advocate
Advocate
Accepted solution

Hi @S_May

 

Try the below Code once 🙂

 

Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oAssyDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence

For Each oOcc In oAssyDoc.ComponentDefinition.AppearanceOverridesObjects
If oOcc.BOMStructure <> kReferenceBOMStructure Then
oOcc.AppearanceSourceType = 100612
End If
Next

For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Or _
oOccurrence.Definition.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then
Component.Color(oOccurrence.Name) = "Red"
End If
Next

 

Regards

B.Sharan Raj

Message 3 of 3

G.DeGheest
Participant
Participant

Question

 

Can the code be adapted to color referenced parts/subassembleys in the Main assembley

 

(to color subassembleys in subassembleys)

(to color parts in subassebleys, in the main assembley)

 

Thank you, for the practical iLogic rule

0 Likes