Bcc.ExportSTLFile
Bcc.ExportSTLFile(File, ObjectID, {ModelSource, TransformMode, TransformMatrix, Scale})
Description
This function allows for exporting an STL file from the workspace or from a CAM job level item (eg. Workpiece, Fixture, etc)
Parameters
- File - the full file path and name of the STL file to export
- ObjectID - the integer ID of the a CAM item in the tree associated to a Job to determine which jobs stock or workpiece, etc you want to get.
Note: Please visit Bcc.GetSelectedCamObjID for more information on retrieving the selected objects ID
- Table - Input parameter table
- ModelSource - string value representing the source location of the CAD geometry to export. Possible choices are:
- Part - Export the full contents of the document to the STL file
- Selection - Export the selected items to the STL file
- Workpiece - Export the geometry assigned to the workpiece item of the CAM job to the STL file
- Stock - Export the stock model geometry of the CAM job to the STL file
- TransformMode - integer value allowing you to choose what origin the STL file will be created relative to
- 0 - No transformation, this will be relative to the world coordinate system
- 1 - Relative to the first / active Machine Setup of the CAM Job
- 2 - Use the transformation matrix passed as the next parameter to modify the model
- TransformMatrix - table containing a 4x4 matrix to apply to the model. This matrix is only utilized if TransformMode is set to 2
- Scale - double value representing the scale value to apply to the model. If the scale value is omitted or set to 0, this will use the current document unit when saving.
IMPORTANT: Please remember that BobCAD products internal units are millimeters, so you must utilize the scale value to get other unit values.
Examples
-- Export the current document solids as STL in millimeters
Bcc.ExportSTLFile("C:\\Part.stl", nil, {ModelSource="Part", TransformMode=0, Scale=1.0})
-- Export the current document solids as STL in current document unit
Bcc.ExportSTLFile("C:\\Part.stl", nil, {ModelSource="Part", TransformMode=0, Scale=0})
-- Export the workpiece from the CAM job as STL in current document unit relative to the machine setup
Bcc.ExportSTLFile("C:\\workpiece.stl", nil, {ModelSource="Workpiece", TransformMode=1})
-- Export the stock model with applied transformation matrix
Bcc.ExportSTLFile("C:\\Stock.stl", nil, {ModelSource="Stock", TransformMode=2, TransformMatrix={{1,0,0,0}, {0,1,0,0}, {0,0,1,0}, {10.0, 0, 5.8, 1.0}}})