def test_export_to_x3d(self): """ 3rd test : export a sphere to X3D file format """ a_sphere = BRepPrimAPI_MakeSphere(10.).Shape() tess = Tesselator(a_sphere) tess.Compute() tess.ExportShapeToX3D(os.path.join("test_io", "sphere.x3d")) self.assert_(os.path.exists(os.path.join("test_io", "sphere.x3d")))
def DisplayShape(self, shape): self._shape = shape print("Tesselate shape ...") t0 = time() tess = Tesselator(self._shape) t1 = time() print("done in %f s." % (t1 - t0)) print("Exporting tesselation to X3D ...") t2 = time() tess.ExportShapeToX3D(self._x3d_filename) t3 = time() print("done in %f s." % (t3 - t2)) print("Generating HTML stream ...") self.GenerateHTMLFile() print("done.") print("Opening html output in the default webbrowser ...") # open the file in the browser _path = "file:///{0}".format( os.path.join(os.getcwd(), self._html_filename)) webbrowser.open_new_tab(_path)
def stpTox3d(filename): shape = read_step_file('stp_uploads/%s.stp' % filename) tess = Tesselator(shape) tess.Compute() tess.ExportShapeToX3D('x3d_output/%s.x3d' % filename)