Function Reference: model.read

drafting: A = model.read (FILE)

Read an assembly from a STEP or 3MF file.

A = model.read (FILE) returns the product the STEP file FILE, .step or .stp, holds as a model.Assembly, in millimetres whatever unit the file was written in: its parts with their names and the colours and solid.Shape.Name of their solids, placed where the file places them and named as it names the placements, and its sub-assemblies the same way. A part the file places several times is one part placed several times. Several products at the top of the file are placed where they are in one assembly, and a file of a single part gives an assembly placing it once; either is named after the base name of FILE. A part without a name is named 'part', an assembly 'assembly', and a name two parts share, or two placements in one assembly, is made distinct with '_2', '_3' and so on. A placement that mirrors its part is an error, since a geom.UCS places rigidly and a mirrored part is another part.

A part of a STEP file is its solids, a closed shell read as the solid it bounds. Surfaces, curves and points are left out with a warning that counts them, a part that holds nothing else is left out of the assembly, and so is a sub-assembly left with no part; a file that holds no solid is an error.

A = model.read (FILE) reads a 3MF file, .3mf, the same way: each object a polymesh.Mesh part, in the colours of its triangles, each object made of others an assembly of them, and the build an assembly named after FILE, unless it is one assembly placed as it is. An object without a name is named after its number, and a name used twice is made distinct. 3MF may place an object scaled or mirrored, which a geom.UCS cannot: such an object is placed as a copy of it, made so, at the origin, named after it with ' (placed)'.

solid.read reads a STEP file as one shape, its parts the solids of it, and polymesh.read a 3MF file as one mesh.

See also: model.Assembly, solid.read, polymesh.read

Source Code: model.read