If you want to color some of your models.

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

If you want to color some of your models.

Post by freedman »

I made a macro that will random color or set to default grey all objects. Thought this might help make some of those grey models light up. To use, run the macro and push a button, Close it when your done. This will over-ride any colors you have set previous.

Hope this helps....
Attachments
multi_color.PNG
multi_color.PNG (25.81 KiB) Viewed 7254 times
Vision_color.FCMacro
(3.01 KiB) Downloaded 125 times
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: If you want to color some of your models.

Post by Roy_043 »

Are you aware of this command?:
Std_RandomColor
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: If you want to color some of your models.

Post by freedman »

Are you aware of this command?:
Std_RandomColor
I didn't know you could do a selected area. Certainly not as easy to use as the macro and I wanted the user to be able to restore a default.

I would like FreeCAD v0.20 to get some additional standard properties like:
visibility_tmp
transparency_tmp
shapeColor_tmp
By switching between the tmp and standard properties a showman could highlight specific portions of a model and then switch back to their previous working colors. Or randomized all the colors in tmp and then switch back to standard.

Once I saw this link I just had to try something, this thing is so cool looking, it would look exceptional in color.
https://forum.freecadweb.org/viewtopic. ... er#p419859
User avatar
watsug
Posts: 100
Joined: Sat Sep 26, 2020 10:51 pm

Re: If you want to color some of your models.

Post by watsug »

Nice!

How do you decide the colors? The code seem to be a constant added to r, g and b. Also, why are the these variables called am, bm, cm?

When you use this macro or stc_RandomColor, the colors are sometimes not so desirable. Something I thought about before was being able to define a "color swatch" or some other way to only use colors that work well together (or colors that match your stylesheet or OS theming).
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: If you want to color some of your models.

Post by freedman »

Also, why are the these variables called am, bm, cm?
If you want to clean up the macro and repost, that's fine, I didn't have alot of time so I did the best I could. Sometimes I post these things and noone pays attention, other times folks read the code.

The am,bm,cm, I was having some trouble so I added a m to abc, it ended up staying like that...

I haven't been able to get the addon manager to work (with me), so when I do I could put this in there.
un1corn
Posts: 240
Joined: Sat Dec 26, 2015 2:06 pm

Re: If you want to color some of your models.

Post by un1corn »

Another way to colour parts is to right click the part in the tree of parts, select set colour, select the part to change colour, choose the colour you want and click ok.
The only drawback I found is that each face of the part has to be selected, which is also good for applying different colours to different face of the same part.
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: If you want to color some of your models.

Post by freedman »

Thought I would update the model color macro. Added Shade or Flat line enabling.
Attachments
Vision_color_plus.FCMacro
(4.54 KiB) Downloaded 99 times
color_shading_pic.JPG
color_shading_pic.JPG (18.61 KiB) Viewed 6097 times
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: If you want to color some of your models.

Post by M4x »

Is this going to be available through the addon manager?
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: If you want to color some of your models.

Post by M4x »

freedman wrote: Sun Nov 08, 2020 2:03 am ping
push
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: If you want to color some of your models.

Post by freedman »

I will try to get it into add-on, I have another macro that I need to do also.
Post Reply