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!
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.
@chennes
I can confirm after aligning the previous commit, it is working correctly.
There is a small discrepancy in the behaviour because the Object Transparency is expressed in 0-100 where Alpha-channel is instead in 0-255

Anyway I think these features are a great improvement for FC and STP import/export and interoperability.

Thanks a lot @realthunder @chennes :D

When everything will be merged, I'll make an announcement at KiCAD forum about these improvements.
Maurice
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: Mon Oct 11, 2021 6:34 pm There is a small discrepancy in the behaviour because the Object Transparency is expressed in 0-100 where Alpha-channel is instead in 0-255
Did I get the scaling wrong, or are you just commenting about the difference in "units" between the Qt color dialog and the output into the STEP file?
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 6:37 pm Did I get the scaling wrong, or are you just commenting about the difference in "units" between the Qt color dialog and the output into the STEP file?
In FreeCAD when you apply Transparency to a Shape, through the Combo View, the value goes between 0 and 100
Combo-view.png
Combo-view.png (38.21 KiB) Viewed 1890 times
-
In the FreeCAD 'Set color' per face Dialog, after selecting a face there is the Alpha channel; the value goes between 0 and 255
alpha-channel.png
alpha-channel.png (51.2 KiB) Viewed 1890 times
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 »

easyw-fc wrote: Mon Oct 11, 2021 8:43 am
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
I've used CATIA V5 (I think it's from 2016 - unbelievable for a FreeCAD-lover :mrgreen: ) but I think that's not very helpful.


transparent-shape-cube.stp

transparent-shape-cube.stp
transparent-shape-cube.stp
transparent-shape-cube.PNG (27.02 KiB) Viewed 1791 times


transparent-faces-cube.stp

transparent-faces-cube.stp
transparent-faces-cube.stp
transparent-faces-cube.PNG (23.49 KiB) Viewed 1791 times


transparent-shape-faces-cube.stp

transparent-shape-faces-cube.stp
transparent-shape-faces-cube.stp
transparent-shape-faces-cube.PNG (23.46 KiB) Viewed 1791 times


Are you sure you've given me the correct files? They look identical in FreeCAD too.

Code: Select all

OS: Ubuntu 20.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.25943 (Git) AppImage
Build type: Release
Branch: master
Hash: a65464b722a846bd2999aa2fecdff1132b15b297
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/United States (en_US)
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: Tue Oct 12, 2021 8:27 pm OS: Ubuntu 20.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.25943 (Git) AppImage
Build type: Release
Branch: master
Hash: a65464b722a846bd2999aa2fecdff1132b15b297
Hi @M4x
thanks for testing it in Catia
your FC version is too old to test the STP files
with FC daily of today https://github.com/FreeCAD/FreeCAD/comm ... b8a8fab36b
you should get this transparent cube for the 'transparent-shape-faces-cube.stp' file
transparent-cube.png
transparent-cube.png (213.25 KiB) Viewed 1770 times
in a recent version of FC (like the one I used) you may try to load the file using the following python code:

Code: Select all

import ImportGui; ImportGui.open(u'/home/mau/Downloads/transparent-shape-faces-cube.stp')
(changing the file path to your downloading location
-
my FC importing Preferences
fc-prefs.png
fc-prefs.png (71.9 KiB) Viewed 1766 times
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: STEP Export/Import colors override (?)

Post by user1234 »

As i saw in the git, that this new feature is implemented, i also wanted to test it and saw the same like easyw-fc, that the values differs (0-100 vs. 0-255). Is this because it uses different functions (coin vs. Qt)?

Greetings
user1234
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 »

user1234 wrote: Wed Oct 13, 2021 12:26 pm the values differs (0-100 vs. 0-255). Is this because it uses different functions (coin vs. Qt)?
Basically, yes: the color selection dialog is a built-in Qt dialog, so uses Qt's normal 0-255 range for all color channels. That's a little annoying/awkward for a non-programmer, so most other places we think of alpha as being a percentage transparency. We could subclass the dialog and change it, but I'm not sure it's worth the effort. That dialog is pretty terrible looking, it would be painful to spend time on it :) .
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: STEP Export/Import colors override (?)

Post by user1234 »

Thanks for the info! Just said: i did not want to seem unthankful. I like that feature! It is just my inner Monk. Does it make sense that the value of the transparency goes from 0-255 and will be parsed in coin? I know it sounds annoying, but i think when someone is scripting, the a face have other values (and naming) as on object is a little bit odd. (If this is scriptable).

But as ai said, it is my inner Monk and i am nitpicking.

Greetings
user1234
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: Wed Oct 13, 2021 12:40 pm
user1234 wrote: Wed Oct 13, 2021 12:26 pm the values differs (0-100 vs. 0-255). Is this because it uses different functions (coin vs. Qt)?
Basically, yes: the color selection dialog is a built-in Qt dialog, so uses Qt's normal 0-255 range for all color channels. That's a little annoying/awkward for a non-programmer, so most other places we think of alpha as being a percentage transparency. We could subclass the dialog and change it, but I'm not sure it's worth the effort. That dialog is pretty terrible looking, it would be painful to spend time on it :) .
an option could be to add the Transparency value to be applied to selected faces int the 'set color per faces' Dialog, instead of enabling the Alpha channel Qt dialog:
dialog-transparency.png
dialog-transparency.png (29.97 KiB) Viewed 1633 times
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: STEP Export/Import colors override (?)

Post by user1234 »

Or replace transparency with alpha. OK, i stop. I am way too picky.

Greetings
user1234
Post Reply