shadows in the freecad viewport

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: shadows in the freecad viewport

Post by wmayer »

File "/run/media/paullee/Home_1/paullee/Downloads/FreeCAD_0.19-17360-Linux-Conda_Py3Qt5_glibc2.12-x86_64/squashfs-root/usr/Mod/Arch/OfflineRenderingUtils.py", line 7 <!DOCTYPE html>
It looks like the file was downloaded from GH via browser and instead of the raw version the HTML page was downloaded.
paullee
Veteran
Posts: 5097
Joined: Wed May 04, 2016 3:58 pm

Re: shadows in the freecad viewport

Post by paullee »

Thanks @werner for the hints - I put in the wrongly downloaded file

Putting back the correct file, it works as indicated :D
Screenshot from 2019-07-22 08-11-59.png
Screenshot from 2019-07-22 08-11-59.png (173.52 KiB) Viewed 2094 times
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

I'm just curious: this works only for BIM projects or any body or part element inside FreeCAD could get the shadows?
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: shadows in the freecad viewport

Post by yorik »

Anything. Even meshes, and even wireframes seem to work too!
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

Working flawlessly here in macOS, it's pretty cool.
How about adding it as a new type of shading? I wish I could load-unload it when I want :D
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: shadows in the freecad viewport

Post by mlampert »

pablogil wrote: Fri Jul 26, 2019 10:42 pm Working flawlessly here in macOS, it's pretty cool.
prove it! :D
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

Here is the prove but, I have realized that it only works with the fist body I have in the hierarchy and anything else... is this normal?:
Captura de pantalla 2019-07-28 a las 10.15.18.png
Captura de pantalla 2019-07-28 a las 10.15.18.png (96.11 KiB) Viewed 1864 times
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: shadows in the freecad viewport

Post by bitacovir »

pablogil wrote: Sun Jul 28, 2019 8:17 am Here is the prove but, I have realized that it only works with the fist body I have in the hierarchy and anything else... is this normal?:
Maybe you need to put the elements into a group like building part.
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: shadows in the freecad viewport

Post by yorik »

The python snippet that Werner provided above will indeed only grab the first element form the scene. To get them all you need to do this:

Code: Select all

from pivy import coin
root = Gui.ActiveDocument.ActiveView.getSceneGraph()
nodes = [node for node in root.getChildren() if isinstance(node, coin.SoSeparator]
newnode = coin.SoSeparator()
for node in nodes:
    newnode.addChild(node) # pack them all into a separator, for convenience
then you use this newnode in your shadowgroup
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

yorik wrote: Mon Jul 29, 2019 2:32 pm The python snippet that Werner provided above will indeed only grab the first element form the scene. To get them all you need to do this:

Code: Select all

from pivy import coin
root = Gui.ActiveDocument.ActiveView.getSceneGraph()
nodes = [node for node in root.getChildren() if isinstance(node, coin.SoSeparator]
newnode = coin.SoSeparator()
for node in nodes:
    newnode.addChild(node) # pack them all into a separator, for convenience
then you use this newnode in your shadowgroup
well, I was actually using your code... could you provide mi a full code to try? I have tried several times to inject your new snippet into the main code and I can't make it work...

Thanks
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
Post Reply