Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Jimmy84
Posts: 9
Joined: Sun Jun 14, 2020 9:21 am

Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by Jimmy84 »

phpBB [video]


Image
The python script and files are hosted on Github :
https://github.com/Athanaze/Freecad-easy-reflections
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by chrisb »

Hi and welcome to the forum, this looks very promising!

Would you mind explaining it a bit? Things such as prerequisits required, how to use, ...
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Jimmy84
Posts: 9
Joined: Sun Jun 14, 2020 9:21 am

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by Jimmy84 »

chrisb wrote: Sun Jun 14, 2020 9:56 am Hi and welcome to the forum, this looks very promising!

Would you mind explaining it a bit? Things such as prerequisits required, how to use, ...
Thanks !
There are no specific prerequisits as far as I know, it's a very simple python script with a bunch of .jpg so it should work just fine on any installation / OS. I have only tested it on Linux (Manjaro) and with FreeCAD 0.18 & 0.19, so your mileage may vary.

For the installation, simply put the "easy_reflections.FCMacro" file and the "easy_reflections" folder in your .FreeCAD/Macro/

You can then use it as you would with any other macros, setting up an icon and placing it on the work bench toolbar.

Because it's just setting an environment map accross all the objects, it should work on any workbench that supports the environment map feature. I personally use it on the Part and Part Design workbenches.

For more infos, head over to the Github repository : https://github.com/Athanaze/Freecad-easy-reflections
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by TheMarkster »

This is neat. Is it possible to make the effect survive closing and reloading the document?
Jimmy84
Posts: 9
Joined: Sun Jun 14, 2020 9:21 am

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by Jimmy84 »

TheMarkster wrote: Mon Jun 15, 2020 1:55 am This is neat. Is it possible to make the effect survive closing and reloading the document?
Unfortunately, it looks like environment textures in FreeCAD are not restored when reloading the document. This also means that when your reopen the document, you have to manually set the "env F" variable (on the left panel) to false, otherwise when you re-execute the macro it crashes FreeCAD.

I would love to solve both of theses problems but I don't know how to execute a macro "on it's own", without user input. This would enable me to reset the correct environment textures and set the "env F" variable ot the approriate value automatically each time the document is reloaded.
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by TheMarkster »

You would probably need to make a workbench.

Find your Mod folder where workbenches are installed, create a folder inside it, add a file called InitGui.py, which gets executed when FreeCAD starts up.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by triplus »

Nice.

P.S. Maybe an integration with Arch Texture could be an option:

https://forum.freecadweb.org/viewtopic.php?t=31598
Jimmy84
Posts: 9
Joined: Sun Jun 14, 2020 9:21 am

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by Jimmy84 »

TheMarkster wrote: Mon Jun 15, 2020 4:32 pm You would probably need to make a workbench.

Find your Mod folder where workbenches are installed, create a folder inside it, add a file called InitGui.py, which gets executed when FreeCAD starts up.
Thanks for your suggestion, but I think putting it in it's own workbench would be kind of useless : I want to work on a part while there are some nice reflections, not just look at it. This is meant to be a quick way to have nicer view of your work; without breaking your flow.
Jimmy84
Posts: 9
Joined: Sun Jun 14, 2020 9:21 am

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by Jimmy84 »

triplus wrote: Mon Jun 15, 2020 5:25 pm Nice.

P.S. Maybe an integration with Arch Texture could be an option:

https://forum.freecadweb.org/viewtopic.php?t=31598
Thanks !
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Easy Reflections in FreeCAD - A macro to quickly setup environment textures

Post by Kunda1 »

Jimmy84 wrote: Tue Jun 16, 2020 6:06 am
triplus wrote: Mon Jun 15, 2020 5:25 pm P.S. Maybe an integration with Arch Texture could be an option:

https://forum.freecadweb.org/viewtopic.php?t=31598
Thanks !
furti wrote::bell:
@furti

Edit: posted to the Arch Texture development thread: https://forum.freecadweb.org/viewtopic. ... 87#p426787
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