Part Color Randomizing Rule and Content Center
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We like to color code the parts in our weldment models & drawings to make the parts easier to distinguish from each other. I have developed a simple iLogic rule to help streamline this process by randomly selecting a part color from a list when a new part is made from the templates that we use for steel plates. This is an external rule that uses a "New Document" trigger, as it is intended to only run once.
All of this works fine. except when I try to extend the idea to also work on Content Center structural parts (angle, tube, etc.). If I change the family template to include this trigger, then place a new part from that family, I always get the "Semi-Polished" appearance, which is default for the "Steel, Mild" material, rather than one of the appearances in the list. Note that the family template is actually saved with one of the listed appearances active. So it's not that the rule is not changing the appearance - it's being changed, but incorrectly.
Also, the can be manually ran on a part generated from Content Center, and work perfectly. It is only the run activated by the "New Document" trigger that messes up.
A modified version of the rule text is below. It has been stripped down to use three appearances from the standard Autodesk-supplied styles, instead of the larger number of custom styles that the real rule uses, to make it easier for someone outside my company to test.
' Create an array from the list of BCR Fabrication Colors appearances. ColorList = New String() {"Red", "Dark Green", "Cadet Blue" } 'Randomly select a color from the list. Randomize() iProperties.PartColor = ColorList(Int(VBMath.Rnd()*3)) RuleParametersOutput() InventorVb.DocumentUpdate()
Is something not being referenced correctly for this to work with CC parts? Or does the "New Document" trigger simply not play nicely with them?