def DisplayShapeAsSVG(self, shp, export_hidden_edges=True, location=gp_Pnt(0, 0, 0), direction=gp_Dir(1, 1, 1), color="black", line_width=0.5): svg_string = export_shape_to_svg( shp, export_hidden_edges=export_hidden_edges, location=location, direction=direction, color=color, line_width=line_width, margin_left=0, margin_top=0) svg = SVG(data=svg_string) display(svg)
def test_export_shape_to_svg(self): svg_filename = get_test_fullname("sample.svg") export_shape_to_svg(A_TOPODS_SHAPE, svg_filename) self.assertTrue(os.path.isfile(svg_filename))
anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment.Value(), aCyl1) anEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(anArc2, aCyl2) anEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment.Value(), aCyl2) threadingWire1 = BRepBuilderAPI_MakeWire(anEdge1OnSurf1.Edge(), anEdge2OnSurf1.Edge()) threadingWire2 = BRepBuilderAPI_MakeWire(anEdge1OnSurf2.Edge(), anEdge2OnSurf2.Edge()) # Compute the 3D representations of the edges/wires breplib.BuildCurves3d(threadingWire1.Shape()) breplib.BuildCurves3d(threadingWire2.Shape()) # Create the surfaces of the threading aTool = BRepOffsetAPI_ThruSections(True) aTool.AddWire(threadingWire1.Wire()) aTool.AddWire(threadingWire2.Wire()) aTool.CheckCompatibility(False) myThreading = aTool.Shape() # Build the resulting compound bottle = TopoDS_Compound() aBuilder = BRep_Builder() aBuilder.MakeCompound(bottle) aBuilder.Add(bottle, myBody_step3.Shape()) aBuilder.Add(bottle, myThreading) print("bottle created") export_shape_to_svg(bottle, "./test_mypy_classic_occ_bottle.svg") write_step_file(bottle, "./test_mypy_classic_occ_bottle.stp")
def test_export_shape_to_svg(self): export_shape_to_svg(A_TOPODS_SHAPE, get_test_fullname('sample.svg'))