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

Need help, or want to share a macro? Post here!
Jimmy84
Posts: 5
Joined: Sun Jun 14, 2020 9:21 am

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

Postby Jimmy84 » Sun Jun 14, 2020 9:27 am

phpBB [video]


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

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

Postby chrisb » 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, ...
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Jimmy84
Posts: 5
Joined: Sun Jun 14, 2020 9:21 am

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

Postby Jimmy84 » Sun Jun 14, 2020 1:43 pm

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
Posts: 2060
Joined: Thu Apr 05, 2018 1:53 am

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

Postby TheMarkster » Mon Jun 15, 2020 1:55 am

This is neat. Is it possible to make the effect survive closing and reloading the document?
My FreeCAD video series on youtube: https://www.youtube.com/c/mwganson
Jimmy84
Posts: 5
Joined: Sun Jun 14, 2020 9:21 am

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

Postby Jimmy84 » Mon Jun 15, 2020 7:05 am

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
Posts: 2060
Joined: Thu Apr 05, 2018 1:53 am

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

Postby TheMarkster » 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.
My FreeCAD video series on youtube: https://www.youtube.com/c/mwganson
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

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

Postby triplus » 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
Jimmy84
Posts: 5
Joined: Sun Jun 14, 2020 9:21 am

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

Postby Jimmy84 » Tue Jun 16, 2020 5:58 am

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: 5
Joined: Sun Jun 14, 2020 9:21 am

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

Postby Jimmy84 » Tue Jun 16, 2020 6:06 am

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
Posts: 9224
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Thu Aug 27, 2020 6:07 pm

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
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features