Function Reference: solid.read

drafting: S = solid.read (FILE)

Read a solid from a STEP file.

S = solid.read (FILE) returns the shapes held by the STEP file FILE as one solid.Shape, in millimetres whatever unit the file was written in. A file holding several parts returns them together, and solid.Shape.numsolids counts them. The colour the file gives a solid, or failing that the first of its faces with one, is its row of solid.Shape.Colour. The name the file gives a solid itself, not the name of the part it belongs to, is its element of solid.Shape.Name.

STEP (ISO 10303-21) is the format every mechanical CAD program exchanges solids in, and it keeps their exact geometry: a hole read from it is a true cylinder, as it was modelled. A STEP file must end in .step or .stp, in either case, and open with the keyword ISO-10303-21;, which may follow white space and comments.

Only solids are read, since a solid.Shape holds solids only. A closed shell, which some programs write in place of a solid, is read as the solid it bounds. Surfaces, curves and points, such as sketches, axes and construction surfaces, are left out with a warning that counts them, and a file that holds no solid is an error.

model.read reads the same file as a model.Assembly, its parts named and placed as the file has them. A triangle mesh, from an STL, OBJ or PLY file, is read by polymesh.read and made a solid by solid.polyhedron.

See also: solid.Shape.write, solid.Shape, model.read, polymesh.read

Source Code: solid.read