STEP Export/Import colors override (?)

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: STEP Export/Import colors override (?)

Post by realthunder »

easyw-fc wrote: Sun Oct 10, 2021 8:11 am here the issue I found:
1) the transparent-shape-cube.stp file is imported and rendered as transparent object in FC, but it is displayed as solid in CADA
(please note that there is a small issue in FC loading a transparent object ... the obj is loaded with its transparency value, but it is not displayed transparent until its transparent property is sligtly changed)
I think that is the correct behavior. The ShapeColor and Transparency properties are the default color/transparency for all faces in a shape, but can be overridden by the DiffuseColor property to get per face color and transparency. In other words, DiffuseColor takes the priority. That is why when you open transparent-shape-cube.FCStd (also the .stp file) in FreeCAD, you see an opaque shape without transparency, which is the same as in CADA. If you then changes the Transparency property, FreeCAD will apply this to all colors in DiffuseColor, and hence you see all faces with transparency.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
jeno
Veteran
Posts: 1821
Joined: Sun Jun 29, 2014 10:41 am

Re: STEP Export/Import colors override (?)

Post by jeno »

andr.syn wrote: Thu Sep 09, 2021 11:02 pm Hello, everyone!
Does anyone notice that colors in STEP models exported from FreeCAD are wrong?
I mean the case when you open them in a different program (if you import those STEPs back in FreeCAD colors would be the same).
But opened with another program, colors do not just look differently at the screen, they have different RGB values.
...
Maybe this is related to this post and the described changes in RGB color space handling introduced in opencascade 7.5.0

Regards
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: STEP Export/Import colors override (?)

Post by easyw-fc »

realthunder wrote: Sun Oct 10, 2021 9:19 am I think that is the correct behavior. The ShapeColor and Transparency properties are the default color/transparency for all faces in a shape, but can be overridden by the DiffuseColor property to get per face color and transparency. In other words, DiffuseColor takes the priority. That is why when you open transparent-shape-cube.FCStd (also the .stp file) in FreeCAD, you see an opaque shape without transparency, which is the same as in CADA. If you then changes the Transparency property, FreeCAD will apply this to all colors in DiffuseColor, and hence you see all faces with transparency.
If this is a correct behaviour, which I agree, then FC has an issue here...
1) get a shape with coloured faces (not transparent)
2) modify the transparency of the shape
3) the displayed result is a shape with also transparent faces
4) save that FC file
5) close and reload the file... the display result will be a solid shape with solid faces even if the shape has te transparent property set to a non solid value
Probably FC should apply to all faces the same transparency applied to shape
Here a small video on it:
phpBB [video]
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: STEP Export/Import colors override (?)

Post by realthunder »

easyw-fc wrote: Sun Oct 10, 2021 1:06 pm Probably FC should apply to all faces the same transparency applied to shape
I have add a commit to do just that. Please check.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: STEP Export/Import colors override (?)

Post by easyw-fc »

realthunder wrote: Sun Oct 10, 2021 2:02 pm I have add a commit to do just that. Please check.
It is just fine!
Many Thanks :D

@realthunder do you think you could have a look also at the dialog to set color per faces, to see if it is possible to add a field to set also transparency for faces?
That would help a lot in handling this property without the need to use python through the console.
set-color-per-face.png
set-color-per-face.png (49.59 KiB) Viewed 2651 times
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: STEP Export/Import colors override (?)

Post by chennes »

easyw-fc wrote: Sun Oct 10, 2021 7:14 pm see if it is possible to add a field to set also transparency for faces?
The good news is that dialog is a Qt-standard one, that already supports alpha channel. So it's just the ColorButton widget that needs to be tweaked to allow that to be enabled.

ETA: git commit 70ad1396e
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: STEP Export/Import colors override (?)

Post by chennes »

May as well add the last bit, I suppose! Please have a look at PR 5106.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: STEP Export/Import colors override (?)

Post by easyw-fc »

chennes wrote: Mon Oct 11, 2021 1:52 am May as well add the last bit, I suppose! Please have a look at PR 5106.
I've tried to build and I get this error:

Code: Select all

Downloads/FreeCAD-daily-src/src/Mod/Part/Gui/TaskFaceColors.cpp:275:25: error: ‘class Gui::ColorButton’ has no member named ‘setAllowTransparency’
  275 |     d->ui->colorButton->setAllowTransparency(true);
My Qt is 5.12.8
EDIT:
@chennes
I think I missed your previous commit http://github.com/FreeCAD/FreeCAD/commit/70ad1396e ...
I'll check it later during the day
Last edited by easyw-fc on Mon Oct 11, 2021 8:36 am, edited 1 time in total.
User avatar
M4x
Veteran
Posts: 1474
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: STEP Export/Import colors override (?)

Post by M4x »

If the test regarding the STEP import using a commercial / proprietary CAD software is still needed, ping me.
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: STEP Export/Import colors override (?)

Post by easyw-fc »

M4x wrote: Mon Oct 11, 2021 7:03 am If the test regarding the STEP import using a commercial / proprietary CAD software is still needed, ping me.
yes please...
you may test this three files
transparent-shape-cube.stp
https://forum.freecadweb.org/download/f ... ?id=166580
this should appear as a solid cube with different colored faces

transparent-faces-cube.stp
https://forum.freecadweb.org/download/f ... ?id=166581
this should appear as a transparent cube with different colored faces

transparent-shape-faces-cube.stp
https://forum.freecadweb.org/download/f ... ?id=166582
also this should appear as a transparent cube with different colored faces
with the same level of transparency of the previous file
Post Reply