Part Color Randomizing Rule and Content Center

Part Color Randomizing Rule and Content Center

jtylerbc
Mentor Mentor
535 Views
3 Replies
Message 1 of 4

Part Color Randomizing Rule and Content Center

jtylerbc
Mentor
Mentor

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?

0 Likes
536 Views
3 Replies
Replies (3)
Message 2 of 4

gcoombridge
Advisor
Advisor

I think FG forces the appearance to 'by material' as a default... I've had issues with this in the part where I published some timber sections which I intended to have a different appearance to the material. Sorry, no solution from me but I am interested...

 

image.png

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
0 Likes
Message 3 of 4

jtylerbc
Mentor
Mentor

@gcoombridge, you're not wrong, but I left a couple of things out of my problem explanation that would have clarified why it doesn't apply in my case.

 

  1. I have a part-level "Color Coded" View Representation.  This gets around the FG color limitation you described, since it is controlling the color of the Default representation.  Depending on exactly what you're trying to do with your timber families, this may work for you as well.
  2. Although we use FG quite a bit, and this rule would eventually be used in FG models, I'm not testing it there quite yet.  The problem as originally explained occurs when placing individual parts from Content Center, without involving Frame Generator so far.
0 Likes
Message 4 of 4

JhoelForshav
Mentor
Mentor

Hi @jtylerbc 

If you have an appearance override and then change the material, the appearance changes to that materials appearance.

Therefore I'm thinking that maybe your rule triggers before the actual property mapping from content center. So it's possible that the rule changes the appearance and then content centers property mapping changes it back?

 

Material_mapping.PNG

0 Likes