transparency disapear by export obj and reimport

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
freeland
Posts: 1
Joined: Fri Sep 16, 2022 5:33 am

transparency disapear by export obj and reimport

Post by freeland »

If I set the transparency to some value and export this think to obj and reimport the file the transparency disappeared.
Hint:
In the .mtl-file exist for each color a line
Tr ...
with the right value. But this is not the modern way to write it and by import FreeCAD read instead rightly the
d ...
line too. But in false direction, then d is complementary to Tr and by import the d-value FreeCAD use it as Tr-value (instaed of 1-d).
Solution:
In Mod/Arch/importOBJ.py (and also src/Mod/Arch/importOBJ.py)
line 254 and 261 I changed "Tr " to "d "
and recompile. As result import and export by FreeCAD self ar good, but not in conjunction with other programms. So I must change line 261 to
outfile.write("d " + str(1-mat[2]/100) + "\n")
and other programs (i. e. Sweet Home 3D) can import the files in right way, but now FreeCAD not. To correct this I has change line 344 to
trans = int((1-float(mline[2:]))*100)
Than all works fine.

On attention to programs using the Tr line it can export this line too by leave
outfile.write("Tr " + str(mat[2]/100) + "\n")
and add after that
outfile.write("d " + str(1-mat[2]/100) + "\n")

with regards
Andreas Matthus
User avatar
onekk
Veteran
Posts: 6208
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: transparency disapear by export obj and reimport

Post by onekk »

Hello,

"help us to help you"

please use the code </> tag when posting code.

Code: Select all

a = sin(b)
as example.

If not the post is very difficult to read.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: transparency disapear by export obj and reimport

Post by Kunda1 »

Someone opened issue #7510
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply