STL Directory Tree
As STL file format is designed to store a single triangulated mesh, DG Kernel
Enterprise offers a way to store structured models in a file directory, called STL
Directory Tree (STL Tree). The directory has specific structure described below.
See also DataFlow sample.
In this release any STL tree contains only .stl files and folders. The
directory structure is designed to preserve structure of the mode with respect
its child/parent relationship.
Example:
Above is an STL tree created for a model called "MyModel".
There are two types of folders inside an STL Tree: Children folder and Object
folder.
Object folder can contain only a single (or none) stl file, which keeps
geometry of a single object. and a single (or none) folder named
"Children". Name of the stl file in an object folder must coincide
with the name of the object folder. Rectangle, Box and Triangle are the
object folders in the above example. Rectangle folder contains a single file named
Rectangle.stl.
A Children folder contains any (or none) number of stl files with arbitrary
names and any number (or none) of Object folders. Children folders should not be
empty. Top level folder or folder of the model ("MyModel" in the above
example) is a Children folder.
Assuming that top level folder is at the level 0 all children folders are
located at even levels in the tree. All Object folders are at odd levels.
During saving or loading of a DG Kernel model to/from an STL Tree objects are saved/loaded in separate stl files with the same name as the object.
Persistence to an STL tree can be performed with the help of IModelEx
interface, which can be queried via: GetModel method of the DG Kernel
component -> IModel ->IModelEx. Methods IModelEx.SaveEx and IModelEx.LoadEx
take a path of the top-level folder (Path of MyModel in example above) and
reference to an ISTLDataContext interface. The later interface is queried from
the same IModelEx. Methods of ISTLDataContext allow setting various
options for the import/export operations. See main documentation for details.
Call ISTLDataContext SetSeparateObjects(true) prior
the save/ load operation will cause persistence to an STL tree as opposite to
persistance to asingle STL file
Note that any model can be saved as single stl file if one does not set the
SeparateObjects above or uses ModelEx.Save, IModelEx.Load or simple by
setting ModelPath property of the component. In this case whole model is
considered as a single triangulated object. During every load of a single STL
file the software detects if there are separate linked triangulated components
inside the stl file, although it is not strictly conforms the STL standard. If
such components are detected, they will be loaded as separate top-level objects
in the model.
|