If you want to color some of your models.

Show off your FreeCAD projects here!
User avatar
M4x
Posts: 966
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

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

Post by M4x »

I've some things to add.
  • I think it would be useful if only selected models would be colored (or recolored) = according to using Random color. Maybe even do exactly the same / use random color if you'd like to keep this functionality in your macro.
  • The same goes for Default color and flat lines (= only selected models / bodies)
  • It's not working with part primitives
freedman
Posts: 2242
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 think it would be useful if only selected models would be colored
I see it only working on a document/model level currently.
It's not working with part primitives
I see it working fine on my Windows machine, Win 10 versions 19 and 20. Not sure how to test that.

I have some newer code that is more efficient and maybe will run better. It would be great if you could try it. I will post in a day or so.
Thanks
User avatar
PJT
Posts: 11
Joined: Sun Aug 15, 2021 9:39 pm

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

Post by PJT »

The problem I have with colours is that if I colour a part and then cut it (to show a cross section) the cut surfaces revert to the default greys and don't keep the colour of the original part. This is especially a problem when I have a compound model of many parts each with their own colour. Does you macro account for / fix that problem? See the attache picture - the blue threaded insert inside the outer threaded tube is supposed to be blue but the cut surface is just a s grey as all the other parts.
Attachments
Bluethread.JPG
Bluethread.JPG (3.92 KiB) Viewed 1577 times
freedman
Posts: 2242
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 wonder if this is graphic card related or a setting. I use open GL in FreeCAD preferences. We certainly see different things, could you post your OS? Here is a pic of a pocket on a thread, I see the same (full color) with a boolean subtract in Part. Maybe this a Help system question.

This macro is an automation tool, no decision making included. It's designed to be a time saver and reflects what the user could do manually with many mouse clicks.
Attachments
color1.JPG
color1.JPG (33.75 KiB) Viewed 1524 times
Syres
Posts: 1263
Joined: Thu Aug 09, 2018 11:14 am

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

Post by Syres »

PJT wrote: Fri Oct 15, 2021 10:41 am The problem I have with colours is that if I colour a part and then cut it (to show a cross section) the cut surfaces revert to the default greys and don't keep the colour of the original part.
In my experience with both Windows and Linux since 0.16 this has always been the case, you have to make the 'cutter' the same colour as the object being cut beforehand and it works as expected.

OS: Linux Mint 19.3 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.20.26153 (Git)
Build type: Release
Branch: master
Hash: 346ff3815dba32c59e62c0892f0bbc03da901cad
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
freedman
Posts: 2242
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 »

Here is my latest. I added the Deviation setting. Each object has a deviation setting and we have two options, "Default" and "High resolution". High resolution will make the curved edges more rounded. Unlike the other visual settings, changing deviation of the model requires the macro to perform a recompute to finish and can take a few seconds, longer on large models. I was kind of hesitant to add deviation settings (because of the recompute) but it really is the last visual setting that can make a big difference in viewing. See in the pic the difference between default and high resolution (right) on two identical pads. If new objects/sketches/features are added then a reclick of the resolution button will refresh the model.

Remember you might need to click "Shade/Flat Line" once or twice to synchronize the setting to the current model.
Attachments
Vision_color_plus2.FCMacro
(7.41 KiB) Downloaded 23 times
color_2.png
color_2.png (87.33 KiB) Viewed 1437 times
Last edited by freedman on Sun Oct 17, 2021 10:58 pm, edited 1 time in total.
User avatar
M4x
Posts: 966
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

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

Post by M4x »

PJT wrote: Fri Oct 15, 2021 10:41 am The problem I have with colours is that if I colour a part and then cut it (to show a cross section) the cut surfaces revert to the default greys and don't keep the colour of the original part.
This thread has some interesting details regarding cuts and coloring: https://forum.freecad.org/viewtopic.php ... b119b30f05
Post Reply