How To Export 3D Geometry
In DynaMaker it is possible to export the geometry generated in DynaMaker in up to 3 different formats:
In all solutions a button is presented to download the data needed, and a custom-made function getGeometryToExport()
is used from the UI-editor tab ACTIONS
that could look something like this:
export function getGeometryToExport() {
const assemblyComponent = getAssemblyComponent() // function in collapsible below
const geometryToExport = assemblyComponent.generateGeometry()
return geometryToExport
}
Or use this function if tags are to be used (e.g. to export geometry excluding parts):
// Option A: via getPartialGeometry():
export function getGeometryToExport({ excludeTags = [] as string[] } = {}) {
const assemblyComponent = getAssemblyComponent()
const geometryToExport = assemblyComponent.generateGeometry().getPartialGeometry({ excludeTags })
return geometryToExport
}
function getAssemblyComponent() {
// it's assumed that your top-level component is called ASSEMBLY
const assemblyComponents = manager.getComponentHandler().getComponents(ASSEMBLY.Component)
if (assemblyComponents.length > 0) {
return assemblyComponents[0]! as ASSEMBLY.Component
} else {
throw new Error('Assembly component missing')
}
}
// Option B: via manager:
export function getGeometryToExport({ excludeTags = [] as string[] } = {}) {
const geometryToExport = manager.getComponentHandler().generateAllGeometry({ excludeTags })
return geometryToExport
}
// Example of use in button with tags:
const stlButton = new SKYUI.Button('Download STL', () => {
const geometryToExport = ACTIONS.getGeometryToExport({ excludeTags: ['screws', 'cables'] })
const stlArray = SKYEXPORT_POLY.generateStlOutput(geometryToExport)
const stlData = stlArray.join('\n')
Studio.downloadFile('bulb.stl', stlData)
})
STL
The STL (stereolithography) format is typically used in 3D printing, CAD, and prototyping, representing objects with triangles and no color or texture for applications like manufacturing, medical implants, and simulations.
To generate STL data from geometry (see example with button below):
- create STL output from geometry with
SKYEXPORT_POLY.generateStlOutput()
- join the resulting list of strings with
join('\n')
to create STL data. - download resulting data with
Studio.downloadFile()
.
const stlButton = new SKYUI.Button('Download STL', () => {
const geometryToExport = ACTIONS.getGeometryToExport()
const stlArray = SKYEXPORT_POLY.generateStlOutput(geometryToExport)
const stlData = stlArray.join('\n')
Studio.downloadFile('bulb.stl', stlData)
})
Notice that the resulting 3D model is hollow (i.e. not solid) if a cut is to be performed.
PLY
The PLY (polygon file) is used in 3D scanning, modeling, and visualization, representing objects as triangles similarly as in STL format, making it useful for scientific 3D scanning and modelling.
To generate PLY data from geometry (see example with button below):
- create PLY output from geometry with
SKYEXPORT_POLY.generatePly()
. - join the resulting list of strings with
join('\n')
to create PLY data. - download resulting data with
Studio.downloadFile()
.
const plyButton = new SKYUI.Button('Download PLY', () => {
const geometryToExport = ACTIONS.getGeometryToExport()
const plyArray = SKYEXPORT_POLY.generatePly(geometryToExport)
const plyData = plyArray.join('\n')
Studio.downloadFile('bulb.ply', plyData)
})
Notice that the resulting 3D model is hollow (i.e. not solid) if a cut is to be performed.
STEP
STEP (Standard for the Exchange of Product Model Data) is used in CAD and manufacturing (typically in aerospace, automotive, and industrial design) to exchange precise 3D product models with geometry, materials, and assembly data, however it doesn't support color or textures.
To generate STEP data from geometry (see example with button below):
- in the dashboard, create a STEP exporter under Exporters (name it e.g. StepExporter).
- go into your new StepExporter and see that the default function asks for geometry as input.
- notice the available optional arguments in
SKYSTEP.StepModel()
.export function generateStep(geometryGroup: SKYCAD.GeometryGroup) {
const step = new SKYSTEP.StepModel({ inputUnit: 'mm' })
step.addGeometry(geometryGroup)
return step
} - go back to the dashboard, and step into the UI editor.
- at the top of the editor, import your new StepExporter through edit/hide imports... as if it's a new subcomponent.
- create STEP output from geometry with
STEPEXPORTER.generateStep()
. - await for the blob to generate
- download the file with
Studio.downloadFile()
const stepButton = new SKYUI.Button('Download STEP', async () => {
const geometryToExport = ACTIONS.getGeometryToExport()
const stepData = STEPEXPORTER.generateStep(geometryToExport)
const blob = await stepData.generateBlob()
Studio.downloadFile('bulb.step', blob)
})
Notice that the resulting 3D model is solid if a cut is to be performed (as seen in section view above). See also that static models will keep their mesh (as the example above), while parametric models built in DynaMaker will keep their smooth surfaces.
In DynaMaker it's also possible to replace certain parts of the geometry with the actual STEP files (i.e. that could contain all 3D details) in the export process. For this the DAS plugin can be used, either on its own or in combination with the STEP exporter.
BIM
BIM (Building Information Modeling, .ifc - Industry Foundation Classes) is used in architecture, construction, and facility management (typically for building design, construction, and maintenance) to represent detailed building models with 3D geometry and rich metadata, including materials and systems, however it doesn't focus on product design like STEP.
If you need to export in BIM (.ifc) format, you need to contact support@dynamaker.com so we can help you enable it for your specific case.