Static Assets
In this tutorial you learn the basics of combining multiple models into one geometry and reusing 2D and 3D assets from other software. You build a metallic beam with a parametric length and fixed end caps.
You complete this in five steps:
1. Create Component
Create a component container and name it BEAM.
2. Create Sketch
A. Upload Asset
Reuse a DXF created in other software and upload it to DynaMaker to generate the beam profile as a sketch.
- Download this beam profile (.dxf).
- In the app dashboard, under Assets, click Upload File.
- Select the file you downloaded.
- Name it PROFILE_75X75_DXF (remove the random ID added when downloading).
- Check Automatically create static sketches from DXF files.
- Click Upload.
You then see the static sketch together with the DXF file in the dashboard, ready to use.
B. Import Asset
Import the asset into the BEAM component:
- Open the BEAM component.
- At the top, click ⚙️ then Edit Imports.
- Check ASSETS.
- Click Apply changes.
All assets are now available inside BEAM.
C. Use Asset
Create a model with a simple extrusion from the static sketch:
- At the top of the code section, click Sketch, select Square, then Create.
- Rename the generated function to
getProfileSketch
. - Replace the default square sketch with the static asset:
const sketch = ASSETS.STATIC_SKETCHES.PROFILE_75X75
- Remove the
size
parameter from the function signature and body (the profile is static now). - Click Save & Run.
- Finished function:
export function getProfileSketch() {
const sketch = ASSETS.STATIC_SKETCHES.PROFILE_75X75
return sketch
}
3. Create Models
A. Beam
Create an extrusion from the sketch:
- Click Model, select Extrude from getProfileSketch, then Create.
- Rename the function to
getProfileModel
. - Click Save & Run and select the function in the left sidebar to view it.
Adjust the profile so it accounts for the end cap thickness and orientation:
- Add the constant:
const endCapThickness = 5
- Set the plane on the x-axis with the offset:
const plane = new SKYCAD.Plane(1, 0, 0, endCapThickness)
- Adjust the extrusion length:
model.addExtrude(sketch, plane, extrudeLength - 2 * endCapThickness)
- Remove
size
from the function (onlyextrudeLength
is used). - Click Save & Run.
- Finished function:
export function getProfileModel(extrudeLength: number) {
const model = new SKYCAD.ParametricModel()
const endCapThickness = 5
const sketch = GEOM2D.getProfileSketch()
const plane = new SKYCAD.Plane(1, 0, 0, endCapThickness)
model.addExtrude(sketch, plane, extrudeLength - 2 * endCapThickness)
return model
}
B. End Caps
- Download this end cap (.glb).
- In the app dashboard, under Assets, click Upload Files.
- Select the file you downloaded.
- Name it PROFILE_END_CAP_GLB.
- Check Automatically create static models from GLB/STL files.
- Click Upload. The static model appears in the dashboard.
Create a function to visualize this static model:
- Open the BEAM component.
- Click Model, select Extrude from any sketch.
- Replace the empty model with the asset:
const model = ASSETS.STATIC_MODELS.PROFILE_END_CAP
- Remove the remaining lines (
sketch
,plane
,extrudeLength
) but keepreturn model
. - Rename the function to
getEndCapModel
. - Click Save & Run.
- Finished function:
export function getEndCapModel() {
const model = ASSETS.STATIC_MODELS.PROFILE_END_CAP
return model
}
This model comes with a texture already, thanks to the GLB format supporting textures.
4. Create Geometry
Assemble both models into a single geometry.
Two or more models can be assembled via a 3D container or geometry group:
const geometryGroup = new SKYCAD.GeometryGroup()
geometryGroup.addGeometry(model1, { position: P1, rotation: R1 })
geometryGroup.addGeometry(model2, { position: P2, rotation: R2, scale: 3 }) // "scale: 3" means 3 times bigger
Optional arguments position
and rotation
define placement in 3D world. They are 3D vectors:
const P1 = new SKYMATH.Vector3D(150, 0, 0) // translated 150 mm in x-direction
const R1 = new SKYMATH.Vector3D(0, 0, Math.PI / 2) // rotated 90 degrees in radians around z-axis
Build the geometry group:
- Create a function
generateGeometryGroup
that returns a geometry group and takesbeamLength
:export function generateGeometryGroup(beamLength: number) {
} - Inside it, create the geometry group:
const geometryGroup = new SKYCAD.GeometryGroup()
- Get the profile model and add it:
const profileModel = getProfileModel(beamLength)
geometryGroup.addGeometry(profileModel) - Get the end cap model:
const endCapModel = getEndCapModel()
- Add the first end cap:
geometryGroup.addGeometry(endCapModel, {
position: new SKYMATH.Vector3D(0, 0, 0)
}) - Add the second end cap with translated position and 180 degree rotation:
geometryGroup.addGeometry(endCapModel, {
position: new SKYMATH.Vector3D(beamLength, 0, 0),
rotation: new SKYMATH.Vector3D(0, 0, Math.PI)
}) - Return the geometry group.
- Finished function:
export function generateGeometryGroup(beamLength: number) {
const geometryGroup = new SKYCAD.GeometryGroup()
const profileModel = getProfileModel(beamLength)
geometryGroup.addGeometry(profileModel)
const endCapModel = getEndCapModel()
geometryGroup.addGeometry(endCapModel, {
position: new SKYMATH.Vector3D(0, 0, 0),
})
geometryGroup.addGeometry(endCapModel, {
position: new SKYMATH.Vector3D(beamLength, 0, 0), // moves "beamLength" in x-direction
rotation: new SKYMATH.Vector3D(0, 0, Math.PI), // rotates 180 degrees in radians around z-axis
})
return geometryGroup
}
5. Add Materials
Customize the appearance by giving the profile a metallic material. A material can be added only when adding a model to a geometry group. Inside generateGeometryGroup
:
- Create the material:
const metalMaterial = new SKYCAD.Material({ color: 0xcccccc, metalness: 1, roughness: 0 })
- Create a list (you can have more than one material):
const beamMaterials = [metalMaterial]
- Assign the material when adding the profile model:
geometryGroup.addGeometry(profileModel, { materials: beamMaterials })
- Final function with material:
export function generateGeometryGroup(beamLength: number) {
const geometryGroup = new SKYCAD.GeometryGroup()
const profileModel = getProfileModel(beamLength)
const metalMaterial = new SKYCAD.Material({
color: 0xcccccc, // grey in hexadecimal
metalness: 1, // value ranges from 0 (non-metal) to 1 (metal)
roughness: 0, // value ranges from 0 (smooth/glossy) to 1 (rough/matte)
})
const beamMaterials = [metalMaterial]
geometryGroup.addGeometry(profileModel, { materials: beamMaterials })
const endCapModel = getEndCapModel()
geometryGroup.addGeometry(endCapModel, {
position: new SKYMATH.Vector3D(0, 0, 0),
})
geometryGroup.addGeometry(endCapModel, {
position: new SKYMATH.Vector3D(beamLength, 0, 0),
rotation: new SKYMATH.Vector3D(0, 0, Math.PI),
})
return geometryGroup
}
You have learned the basics of modeling. Turn your models into a component with customizable properties in the next tutorial: Parts.