Skip to main content
1-Visitor
October 30, 2014
Question

how to change color of a part using relation?

  • October 30, 2014
  • 5 replies
  • 10003 views

Hello,

Is there some posibility to chnge color of a created part using a relation in start_part_solid.prt?

for example - if the PTC_COMMON_NAME_IS screw, then color of the part should be for ex. red....

Thanks in advance

T.


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

5 replies

KenFarley
21-Topaz II
October 30, 2014

No, it's not possible. I don't know if it will ever be possible, even though it would be very useful. For example, if you use springs from a particular supplier, they tend to be color coded based on their type. It would be great to have them reflect that in the model when you use a specific one from a family table.

Oh, well.

thlavinka1-VisitorAuthor
1-Visitor
October 30, 2014

so lets belive one day it will be possible

12-Amethyst
November 4, 2014

I suppose you can use a offset feature of zero value to do that.

I tried and found out that it´s easier to do with offset from Flexible Modeling.

See if my video helps.

Jose

Video Link : 5426

12-Amethyst
November 5, 2014

Okay, I tried next step, changing in relations and I think it can be done:

Video Link : 5427

For this you need Pro/program and Relations.

For my example, I did it like this:

1. Created 3 parameters Yes/No type:

BLUE_RESUME

YELLOW_RESUME

GREEN_RESUME

And a Integer parameter:

COLOR

2.Created the following relations:

COLOR=0

/****************

BLUE_RESUME=NO

GREEN_RESUME=NO

YELLOW_RESUME=NO

/****************

IF COLOR==1

BLUE_RESUME=YES

GREEN_RESUME=NO

YELLOW_RESUME=NO

ENDIF

/****************

IF COLOR==2

BLUE_RESUME=NO

GREEN_RESUME=YES

YELLOW_RESUME=NO

ENDIF

/****************

IF COLOR==3

BLUE_RESUME=NO

GREEN_RESUME=NO

YELLOW_RESUME=YES

ENDIF

3. Enter the Program, search for the feature "BLUE" and change to:

IF BLUE_RESUME==YES

ADD FEATURE

INTERNAL FEATURE ID 1849

... .... ....

END ADD

END IF

Repeat for Yellow and Green.

It is also possible to use a family table, a much more simpler solution.

Jose

thlavinka1-VisitorAuthor
1-Visitor
November 7, 2014

Great!

And is it possible to add a rule for ex.: if model_name=XXX then the color will be COLOR_1?

2-Explorer
November 7, 2014

It will need some system in model naming.

Example:

Model name: part_01-red

Relation:

part_name=EXTRACT(REL_MODEL_NAME,1,SEARCH(EXTRACT(REL_MODEL_NAME,1,(\STRING_LENGTH(REL_MODEL_NAME))),"-")-1)

part_color=EXTRACT(REL_MODEL_NAME,(SEARCH(REL_MODEL_NAME,"-")+1),((\STRING_LENGTH(REL_MODEL_NAME))-(SEARCH(REL_MODEL_NAME,"-")+1)+1))

IMPORTANT: Use only 1 "-" in model name. This mark will divide part name into 2 parts.

Before "-" it´s parameter called part_name.

After "-" it´s parameter called part_color.

Relation:

IF part_color == red

.....

.....

....

ENDIF

Patriot_1776
22-Sapphire II
November 7, 2014

Why would you want to do this? You can assign appearances to materials, and then specify the material. Then you also get material properties.

1-Visitor
November 7, 2014

That would mean that the user would need to update the material everytime!!! LOL

Patriot_1776
22-Sapphire II
November 10, 2014

So? You'd get proper material properties. As antonius mentioned, the appearance is a little buggy when using fam tables, but I think a second regen fixes that if I remember.

If you want to be lazy, you could simply wrote a relation to change the material. I.E. if TITLE1 == "SCREW" THEN ptc_material_name = steel

Not sure the syntax is 100% but you get the picture.

2-Explorer
November 9, 2014

Mainly keep it simply!!!

Just some ideas:

What about BULK items? See ProE help for more informations...

What about restricted parameters? And restricted parameters tables? See ProE help...

How many different parts do you wanna create? Is it 10 or 100 000? Has it any sence to make so "coplicated" method?

thlavinka1-VisitorAuthor
1-Visitor
November 10, 2014

I havent heard about bulk items yet - thanks for a suggestion.

I created one BULK item with two instances in family table. Now i would need to make following relations in assembly template:

- in case the assembly contains a part or subassembly with model name starting "JD_" then i need to assign a parameter "BARVA" (value RAL_5018) from the BULK into a table in asm drawing.

in case the assembly contains part or subassembly with model name starting "MF_" then i need to assign a parameter "BARVA" (value RAL_1012) from the BULK into a table in asm drawing.

2-Explorer
November 10, 2014

All necessary information are here in this topic. Try it in your own...