3D Model Parts

An intended use of the scripts/packages mechanism is that scripts can server as 3d model parts that can be imported into other bigger models. This allows to build up libraries of parts that can be reused in multiple scopes and projects.

Packages that contain open parameters can be handled as described in section Open Parameters in Packages.

The main Solid Object

If a 3D model is generated within a package, this solid can be accessed via the main member of the package.

File "part.sps":

Example

make rgb(255,0,0) >> sphere(2.0)

Main script file:

Example

#import ( "part.sps" )
solid myObject = part::main
make myObject

As soon as the package member main is accessed from the importing script the package is executed. This execution happens once per imported instance of the package, i.e. accessing member main multiple times does not lead to repeated executions of the package instance. If multiple executions of the package are desired either the package reset command can be used or multiple instances of the package can be imported (see Repeated package import ) and accessed via main each. The package member main is a normal solid that can e.g. be generated via the make command.