STEP Export/Import colors override (?)
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: STEP Export/Import colors override (?)
I will try, thank you.
Re: STEP Export/Import colors override (?)
Thank you for adding a link here.
Re: STEP Export/Import colors override (?)
I've added a note at the tracker:
https://tracker.freecadweb.org/view.php?id=4744#c15957
it could be related to OCC release version, not to FC version ...
[OCCT] 7.5.0 recently additions -> 0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes
https://tracker.dev.opencascade.org/view.php?id=299020029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes
Description XCAF defines a structure XCAFPrs_Style accumulating visual properties:
- Surface color and transparency, RGBA;
- Curve color, RGB;
- Hidden flag, Boolean.
EDIT:
if we can fix this, we could also add the transparency property to import/export STEP files.
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: STEP Export/Import colors override (?)
PR submitted here. See the PR comments for more details. The PR also adds support for STEP transparency. It's a small change and somewhat related, so I just grouped them together.easyw-fc wrote: ↑Sat Oct 02, 2021 9:14 am I've added a note at the tracker:
https://tracker.freecadweb.org/view.php?id=4744#c15957
it could be related to OCC release version, not to FC version ...
Re: STEP Export/Import colors override (?)
@realthunderrealthunder wrote: ↑Thu Oct 07, 2021 9:47 am PR submitted here. See the PR comments for more details. The PR also adds support for STEP transparency. It's a small change and somewhat related, so I just grouped them together.
Thanks a lot for taking care of it!
I've tested this branch under Linux and I noticed that Transparency attribute seems not to be exported correctly.
I have viewed the STP file in a text editor and I found:
Code: Select all
#181 = SURFACE_STYLE_TRANSPARENT(0.300000011921);
...
#194 = SURFACE_STYLE_TRANSPARENT(1.);
...
#204 = SURFACE_STYLE_TRANSPARENT(1.);
...
Here the simple Cube with faced colored and transparency applied to shape file exported as STP
You can test the Import/export STP files with CadAssistant
https://www.opencascade.com/products/cad-assistant/
It is available for win, osx and Linux and it is handling transparency feature (no need to register to download and use)
latest version: cad_assistant_1.6.0_2021-10-05
May be we should split the commit in two ... one for fixing colors and one for transparency
Re: STEP Export/Import colors override (?)
Hi @realthunder,realthunder wrote: ↑Thu Oct 07, 2021 9:47 am PR submitted here. See the PR comments for more details. The PR also adds support for STEP transparency. It's a small change and somewhat related, so I just grouped them together.
I have tested your recent update and it seems much better.
I just found a user case that may be needs an other tweak...
I'm attaching:
1) a cube with different coloured faces made transparent as shape 2) a cube with different coloured faces with two transparent faces and the shape solid the exported stp files are reloaded fine in FC, but not in CadAssistant
3) the stp file with only the shape transparent, but with different colored faces is rendered as solid in CADA, but transparent in FC 4) the stp file with only the transparent coloured faces, and with the shape solid is rendered in the same way both in CADA and in FC, displaying the two faces as transparent I don't know if the CADA approach is the one used in most CAD sw as SWork or PTC etc...
May be to keep the same appearance both in CADA and FC, when exorting a transparent cube with coloured faces, it would be possible to assign the same transparency both to shape and all faces ...
What do you think?
Is there some user having access to proprietary CAD to check in which way the two STP files are rendered?
EDIT
Here also
5) a cube with different coloured all transparent faces and with a transparent shape This is displayed similarly in FC and CADA.. I'm not sure if in CADA the transparency key is 'summed' between the face and the shape values
Thanks
Maurice
Re: STEP Export/Import colors override (?)
and here the FC source file for
5) a cube with different coloured all transparent faces and with a transparent shape the exported stp file (the same of above) and the code I used to make the faces transparent
here the forum page related to 'per face transparency'
https://forum.freecadweb.org/viewtopic.php?t=16476
5) a cube with different coloured all transparent faces and with a transparent shape the exported stp file (the same of above) and the code I used to make the faces transparent
Code: Select all
App.ActiveDocument.Box.ViewObject.DiffuseColor=[(0.0, 0.0, 1.0, 0.5), (0.0, 1.0, 1.0, 0.5), (0.6666666865348816, 0.0, 0.0, 0.5), (1.0, 1.0, 0.0, 0.5), (0.0, 0.0, 1.0, 0.5), (0.0, 0.0, 1.0, 0.5)]
https://forum.freecadweb.org/viewtopic.php?t=16476
At the moment, the color editor of FreeCAD cannot set transparency, so the only way to set per-face transparency is from python.
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: STEP Export/Import colors override (?)
I just tested these files with CADA and the PR branch, and didn't notice any problem. Have you sync the branch? Maybe can post the picture showing the problem?
Re: STEP Export/Import colors override (?)
Hi @realthunderrealthunder wrote: ↑Sun Oct 10, 2021 7:05 am I just tested these files with CADA and the PR branch, and didn't notice any problem. Have you sync the branch? Maybe can post the picture showing the problem?
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) -
2) to have the same result I needed to set transparency also on all the faces of the cube -
What I have noticed is that to get the same behavior in FC and CAD, displaying a shape with transparent property in FC, the exporter should apply transparency at least to all the faces or to shape and faces
-