- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good morning,
I have iLogic that I am currently using to change colors on parts a given assembly that works great that I will post at the end. The problem that I am having is trying to use the same code with a color that I have added the the Inventor Material Library. I did notice that if I have the color in the Document Appearances it will work, but that means I would have through dozens of assemblies to achieve this.
My question is there a way to use the ilogic I have to make either add the color needed to the document or have it only look at my Inventor Material Library???
I have only copied the iLogic that directly changes the color, if I need to post the rest please let me know. I have also added *** to omit names.
Sub Main oTrigger = TREADCOLOR iLogicVb.UpdateWhenDone = True oColor = Parameter("TREADCOLOR") oColor = Replace(oColor, "****", "") 'replace ****with nothing (strips off ****if found) oColor = Replace(oColor, "****", "") 'replace ****with nothing (strips off ****if found) oColor = Replace(oColor, "****", "") 'replace OSHA with nothing (strips off ****if found) oColor = Trim(oColor) 'trim off extra spaces oColor = StrConv(oColor, VbStrConv.ProperCase) 'convert to Title Case (first letter cap) If oColor = "Blue" Then oColor = "Blue - Wall Paint - Glossy" End If If oColor = "Black" Then 'I added this if statement to change colors to the black needed. oColor = "Black - Smooth" 'I added this if statement to change colors to the black needed. End If 'I added this if statement to change colors to the black needed. For i = 1 To 20 If Parameter("TREADTYPE") = "DP" And Parameter("STAIRWIDTH") = 36 Then oCompName = "***-TREAD-2X10X36-ZINC:" & i Else If Parameter("TREADTYPE") = "DP" And Not Parameter("STAIRWIDTH") = 36 Then oCompName = "*** TREAD:" & i Else If Parameter("TREADTYPE") = "SG" Then oCompName = "*** TREAD SG:" & i End If oComp = Component.InventorComponent(oCompName) If oComp.Visible = False Then Continue For 'skip if not visible Call CopyColor(oComp, oColor) 'make sure color is in assembly Call SetViewRep(oComp) 'set to default view rep 'step through sub assembly and color all components Call ProcessComponents(oComp.Definition.Document, oCompName, oColor) Next End Sub
Solved! Go to Solution.