Skip to main content

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
  2. Create sketch
  3. Create models
  4. Create geometry
  5. Add materials

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.

  1. Download this beam profile (.dxf).
  2. In the app dashboard, under Assets, click Upload File.
  3. Select the file you downloaded.
  4. Name it PROFILE_75X75_DXF (remove the random ID added when downloading).
  5. Check Automatically create static sketches from DXF files.
  6. 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:

  1. Open the BEAM component.
  2. At the top, click ⚙️ then Edit Imports.
  3. Check ASSETS.
  4. Click Apply changes.

All assets are now available inside BEAM.

C. Use Asset

Create a model with a simple extrusion from the static sketch:

  1. At the top of the code section, click Sketch, select Square, then Create.
  2. Rename the generated function to getProfileSketch.
  3. Replace the default square sketch with the static asset:
    const sketch = ASSETS.STATIC_SKETCHES.PROFILE_75X75
  4. Remove the size parameter from the function signature and body (the profile is static now).
  5. Click Save & Run.
  6. 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:

  1. Click Model, select Extrude from getProfileSketch, then Create.
  2. Rename the function to getProfileModel.
  3. 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:

  1. Add the constant:
    const endCapThickness = 5
  2. Set the plane on the x-axis with the offset:
    const plane = new SKYCAD.Plane(1, 0, 0, endCapThickness)
  3. Adjust the extrusion length:
    model.addExtrude(sketch, plane, extrudeLength - 2 * endCapThickness)
  4. Remove size from the function (only extrudeLength is used).
  5. Click Save & Run.
  6. 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

  1. Download this end cap (.glb).
  2. In the app dashboard, under Assets, click Upload Files.
  3. Select the file you downloaded.
  4. Name it PROFILE_END_CAP_GLB.
  5. Check Automatically create static models from GLB/STL files.
  6. Click Upload. The static model appears in the dashboard.

Create a function to visualize this static model:

  1. Open the BEAM component.
  2. Click Model, select Extrude from any sketch.
  3. Replace the empty model with the asset:
    const model = ASSETS.STATIC_MODELS.PROFILE_END_CAP
  4. Remove the remaining lines (sketch, plane, extrudeLength) but keep return model.
  5. Rename the function to getEndCapModel.
  6. Click Save & Run.
  7. Finished function:
    export function getEndCapModel() {
    const model = ASSETS.STATIC_MODELS.PROFILE_END_CAP
    return model
    }

note

This model comes with a texture already, thanks to the GLB format supporting textures.

4. Create Geometry

Assemble both models into a single geometry.

info

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:

  1. Create a function generateGeometryGroup that returns a geometry group and takes beamLength:
    export function generateGeometryGroup(beamLength: number) {

    }
  2. Inside it, create the geometry group:
    const geometryGroup = new SKYCAD.GeometryGroup()
  3. Get the profile model and add it:
    const profileModel = getProfileModel(beamLength)
    geometryGroup.addGeometry(profileModel)
  4. Get the end cap model:
    const endCapModel = getEndCapModel()
  5. Add the first end cap:
    geometryGroup.addGeometry(endCapModel, {
    position: new SKYMATH.Vector3D(0, 0, 0)
    })
  6. 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)
    })
  7. Return the geometry group.
  8. 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:

  1. Create the material:
    const metalMaterial = new SKYCAD.Material({ color: 0xcccccc, metalness: 1, roughness: 0 })
  2. Create a list (you can have more than one material):
    const beamMaterials = [metalMaterial]
  3. Assign the material when adding the profile model:
    geometryGroup.addGeometry(profileModel, { materials: beamMaterials })
  4. 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.