OCC.Extend.DataExchange module

edge_to_svg_polyline(topods_edge, tol=0.1, unit='mm')

Returns a svgwrite.Path for the edge, and the 2d bounding box

export_shape_to_svg(shape, filename=None, width=800, height=600, margin_left=10, margin_top=30, export_hidden_edges=True, location=<class 'gp_Pnt'>, direction=<class 'gp_Dir'>, color='black', line_width='1px', unit='mm')

export a single shape to an svg file and/or string. shape: the TopoDS_Shape to export filename (optional): if provided, save to an svg file width, height (optional): integers, specify the canva size in pixels margin_left, margin_top (optional): integers, in pixel export_hidden_edges (optional): whether or not draw hidden edges using a dashed line location (optional): a gp_Pnt, the lookat direction (optional): to set up the projector direction color (optional), “default to “black”. line_width (optional, default to 1): an integer

read_iges_file(filename, return_as_shapes=False, verbosity=False, visible_only=False)

read the IGES file and returns a compound filename: the file path return_as_shapes: optional, False by default. If True returns a list of shapes,

else returns a single compound

verbosity: optionl, False by default.

read_step_file(filename, as_compound=True, verbosity=True)

read the STEP file and returns a compound filename: the file path verbosity: optional, False by default. as_compound: True by default. If there are more than one shape at root, gather all shapes into one compound. Otherwise returns a list of shapes.

read_step_file_with_names_colors(filename)

Returns list of tuples (topods_shape, label, color) Use OCAF.

read_stl_file(filename)

opens a stl file, reads the content, and returns a BRep topods_shape object

write_iges_file(a_shape, filename)

exports a shape to a STEP file a_shape: the topods_shape to export (a compound, a solid etc.) filename: the filename application protocol: “AP203” or “AP214”

write_step_file(a_shape, filename, application_protocol='AP203')

exports a shape to a STEP file a_shape: the topods_shape to export (a compound, a solid etc.) filename: the filename application protocol: “AP203” or “AP214IS” or “AP242DIS”

write_stl_file(a_shape, filename, mode='ascii', linear_deflection=0.9, angular_deflection=0.5)

export the shape to a STL file Be careful, the shape first need to be explicitely meshed using BRepMesh_IncrementalMesh a_shape: the topods_shape to export filename: the filename mode: optional, “ascii” by default. Can either be “binary” linear_deflection: optional, default to 0.001. Lower, more occurate mesh angular_deflection: optional, default to 0.5. Lower, more accurate_mesh