#!/usr/bin/env python # coding: utf-8 # In[2]: 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 from OCC.Display.WebGl.x3dom_renderer import X3DExporter # In[ ]: # In[3]: shp = read_step_file(os.path.join('assets', 'models', 'Ventilator.stp')) # In[4]: x3dexp = X3DExporter(shp, None, None, False, (1,1,0), (0,0,0), 0, 0, (0,0,0), 2, 1) # In[5]: x3dexp.compute() # In[6]: len(x3dexp._triangle_sets) # In[7]: x3d=x3dexp.to_x3dfile_string(0) # In[17]: print(x3d) from OCC.Core.VrmlAPI import VrmlAPI_Writer # In[15]: myWriter = VrmlAPI_Writer() # In[16]: myWriter.Write(shp,'Vent.wrl') # # In[ ]: