pythonocc-demos
pythonocc-demos copied to clipboard
SVG rendering functions missing in display_as_svg notebook
Hello,
We have discovered in a freshly installed pythonocc-core (7.4.0rc1) on conda that the two functions required by the display_as_svg
jupyter notebook example are not present in the library:
import os
from OCC.Core.gp import gp_Dir
from OCC.Display.WebGl.jupyter_renderer import JupyterRenderer
from OCC.Extend.DataExchange import read_step_file, export_shape_to_svg
results in
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-9-13466bb7a556> in <module>
3 from OCC.Core.gp import gp_Dir
4 from OCC.Display.WebGl.jupyter_renderer import JupyterRenderer
----> 5 from OCC.Extend.DataExchange import read_step_file, export_shape_to_svg
ImportError: cannot import name 'export_shape_to_svg' from 'OCC.Extend.DataExchange' (/home/artonson/miniconda3/envs/occ/lib/python3.7/site-packages/OCC/Extend/DataExchange.py)
and
my_renderer.DisplayShapeAsSVG(robot_shp, direction=gp_Dir(1, 1, 0.1),
export_hidden_edges=False,
line_width=1.5)
yields
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-8-515d1b0f4da5> in <module>
----> 1 my_renderer.DisplayShapeAsSVG(robot_shp, direction=gp_Dir(1, 1, 0.1),
2 export_hidden_edges=False,
3 line_width=1.5)
AttributeError: 'JupyterRenderer' object has no attribute 'DisplayShapeAsSVG'
Platform: Linux 16.04 conda 4.6.14
Can you comment on where things could have gone wrong?
Kind regards, Alexey
The svg export example was added a few days ago to the example suite. The related code in the pythonocc baseline was committed as the same time, in the branch known as https://github.com/tpaviot/pythonocc-core/tree/review/jupyter-fixes This branch is still under development and has not been merged yet into master, it requires some more tests. It will be available in the next rc2 release.
So far, if you want to test this feature, you can compile the branch by your own or test online at https://mybinder.org/v2/gh/tpaviot/pythonocc-binderhub/review/jup-fixes and run the display_as_svg notebook. The results should look like
This might interest @Dar5han7 as well.
Thank you! Will try that branch, then.
Does the package build system work in that branch, or is there a working docker?