Autodesk Inventor Customization
- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Assembly Colour Finish
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have borrowed a few lines of iLogic code to change all parts to the same colour from here:
Rule:
Dim num As Long
num = ThisApplication.ActiveDocument.ComponentDefinition
jj=1
While jj<num+1
Component.Color(ThisApplication.ActiveDocument.Com
jj=jj+1
End While
iLogicVb.UpdateWhenDone = True
This rule user a multi value text user parameter where I have input a group of colours.
I then apply this rule to my form for control of the final assembly.
Is there a way to alter this rule or better yet add another rule to over ride so that 3 parts of my assembly can be changed to another colour?
I have an assembly with ~200 parts and all same colour except for 3 parts. These three parts are the same colour as well. I can use specific files names in the rule as these will never change.
I would like to have a rule for this so I can add it to my form that I use to control size parameters and colours.
Thanks
Sean
Product Designer at TESInc.ca
Inventor Professional 2014 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 314.22
Solved! Go to Solution.
Re: Assembly Colour Finish
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I meant to add some screenshots to help clarify. first image is what I currently have, Paint Finish changes all parts in the assembly to selected colour.
Second Image shows what I am trying to do, There are 3 parts called backplates that should be a different colour.
Any help would be awesome!!
Thanks
Sean
Product Designer at TESInc.ca
Inventor Professional 2014 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 314.22
Re: Assembly Colour Finish
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Hope the code below helps:
'name list of specific parts
' Note: case sensitive!!
Dim listOfSpecificPart() As String = New String(){"Part1:1", "part2:1"}
num = ThisApplication.ActiveDocument.ComponentDefinition .Occurrences.Count
jj=1
While jj<num+1
Dim eachOccName
eachOccName = ThisApplication.ActiveDocument.ComponentDefinition .Occurrences.Item(jj).Name
' check if this is a specific part
Dim oIndex As Integer = Array.IndexOf(listOfSpecificPart, eachOccName)
If oIndex > 0 Then
Component.Color(eachOccName) = black_colour
Else
Component.Color(eachOccName) = paint_colour
End If
jj=jj+1
End While
iLogicVb.UpdateWhenDone = True
Xiaodong Liang
Developer Technical Services
Autodesk Developer Network
Re: Assembly Colour Finish
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This rule is almost perfect,
I have created another multi-value user parameter called backplate_colour, edited the rule you provided, added in the 3 parts file names and it works except for the first part file in the list of 3 doesn't change. It is not a problem with the part file, because I re-arranged the file order and it still doesnt apply the colour change to the first file in the list. Not sure what this could be.
I have attached a few images t show what I mean.
Thanks
Sean Farr
Product Designer at TESInc.ca
Inventor Professional 2014 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 314.22
Re: Assembly Colour Finish
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I still do know why the first part in the list of parts doesnt change colour, but I have found a work around.
I added the bolts to the list of parts and made sure it was first in the list, as these are painted with the frame (blue in this case). Bolts are MPC-100010
Then I added my 3 backplates (white in this case), so since the bolts were first in the list, they didn't change to white, but my 3 backplates changed. Backplates are MPC-100011, MPC-100012, MPC-100013
So it works, see attached image.
Thanks for your help.
Sean Farr
Product Designer at TESInc.ca
Inventor Professional 2014 - AutoCAD Electrical 2014
Win7-x64 | ASUS P8Z77-V | i7 3770 -3.4 GHz | 32GB RAM |
240GB SSD | nVidia GTX 670 4GB - 314.22

