cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

how to change color of a part using relation?

thlavinka
1-Newbie

how to change color of a part using relation?

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.
23 REPLIES 23

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.

so lets belive one day it will be possible

scooke
4-Participant
(To:KenFarley)

In terms of springs in family tables, a work around is to create as many quilts (copied from the geometry) as you need colours. Then include the quilts in the top level of the family table. (see image below) When you choose the strength of the spring then the colour changes in your assembly. (probably doesn't answer the original question but we find this useful).

Image_162.jpg

mbonka
15-Moonstone
(To:scooke)

Sometimes l use exactly same method as Steve Cooke and it works fine for me.

l think it depends on model complexity.

Don´t know better method than thise one.

Jose_Costa
6-Contributor
(To:thlavinka)

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

Jose_Costa
6-Contributor
(To:thlavinka)

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

Great!

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

mbonka
15-Moonstone
(To:thlavinka)

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

Looks great! As soon as i have free time i will try it. Thanks a lot. T.

mbonka
15-Moonstone
(To:thlavinka)

See attached file.

It´s Creo 2.0 M070 version. Hope you can open it.

l added some comments inside relations tab.

If it helps you, mark thise topic as answered.

Need regeneration after model name change.

Change name between 3 posibilities:

1. COLORED_CUBE-GREEN ---> green color

2. COLORED_CUBE-BLUE ---> blue color

3. COLORED_CUBE-XXXXX ---> part default color

Best regards

Milan Bonka

Hi Milan,

Thank you very much for files you sent me - it works fine and i got an idea how it works but i am not as good at programming to get those relations working for my purposes.

I would like to clarify a bit more what i need this relations for:

- i use creo to design welding fixtures. Those fixtures are made for several customers and each of these customers wants to have a different colour of the tool which is then indicated in the assembly drawing. The problem is that very often i just forget to fill in this in the drawing.

Based on that i got the idea to fill in this information automatically.

So there is an assembly with the fixture and welded part inside. The welded part has always a MODEL_NAME that starts with two letters jike "JD" or "MF" ,.... according to those letters i would like to assign information (for ex. for "JD" it would be "RAL_5018", "MF" RAL_1012,...). The idea is to assign a name of the particullar color in .dmt file to the assembly and mention in the drawing. Those relations would be in an assembly template.

Do you think it could work somehow?

I enclosed the example of my assembly template and appearance.dmt with all customer colours

I enclosed an example of assembly with appearance.dmt where are all colors starting with RAL

B.R.

Patriot_1776
22-Sapphire II
(To:thlavinka)

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

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

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.

Creo appears to just take on a color and sticks to it like glue. I'd like to see it work in a short video if someone can make it work. It's a very wonky dialog only in the material appearance tab.

This appears to have been an issue for 3 years now beginning with WF5.

I don't suppose we can expect a fix any time soon since even Creo 3.0 is affected.

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS33983&source=minisearch

I wonder if the same problem exists with x-hatching style

According to the recommended workaround #2, if only one of the FT instances in in session, it works as intended.

Patriot_1776
22-Sapphire II
(To:TomD.inPDX)

Yeah, I remember trying it in WF4 and it being an issue. If I remember, ALL the instances changed to the last appearance placed in the assy, then you had to do another regen and they changed to what they should have been. That's what I seem to remember, it's been a while. I had this great idea to build our fasteners and o-rings etc. with appearances, so you could easily see if you had the wrong P/N installed if you needed, say, a stainless screw instead of a black oxide carbon steel, or a rubber o-ring vs a viton o-ring.... The bug put paid to that......

I don't know how PTC can ignore open issues such as this for so long and let them creep into new releases.

Someone needs to be hung! With the new appearance capabilities in Creo 3.0, this is embarrassing!

From a family table library standpoint, this "bug" defeats the entire purpose for having comprehensive libraries in family tables! A CORE FUNCTIONALITY!

Someone has got to be kidding as the 1st workaround form PTC is copying the surfaces. Come one; really!

Patriot_1776
22-Sapphire II
(To:TomD.inPDX)

Agreed! Shows their contempt for their customers. I have a friend who recently quit corporate life to start his own business. I halped train him in Pro/E, but he's starting his own business using.......Solidquirks. Surprised?

You can change materials in family tables but the appearance does not change. This appears to be a bug.

mbonka
15-Moonstone
(To:thlavinka)

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?

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.

mbonka
15-Moonstone
(To:thlavinka)

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

Top Tags