Skip to main content

How To Use Static Assets

In DynaMaker it is possible to use assets that are already created in other software or in DynaMaker itself. We have two examples that explain how to use them, one for each type of static asset:

Static Sketches

As a product example, we take the profile of three metal sheets that are already bent. We will create metal sheets with exactly those profiles and parametrize the length. You can download the following DXF files for each profile:

how-to-use-static-assets-sketches-1

Before being able to use them in your component, you need to import them into your project.

  • Upload all three files to your project in the dashboard under Files. how-to-use-static-assets-sketches-2

  • Create a Static Sketch for each file: how-to-use-static-assets-sketches-3

Now you should be able to use the sketches within your component in this case.

  • Import ASSETS into your component. how-to-use-static-assets-models-3

  • Use these sketches as regular ones. Here is an example of a geometry group including all sketches in separate models with their own color.

export function generateSheetsGeometryGroup(sheetLength: number) {
const geometryGroup = new SKYCAD.GeometryGroup()

const refPlane = new SKYCAD.Plane(1, 0, 0, 0)

const leftProfileModel = new SKYCAD.ParametricModel()
const leftProfileSketch = ASSETS.STATIC_SKETCHES.SHEET_LEFT_PROFILE_DXF
leftProfileModel.addExtrude(leftProfileSketch, refPlane, sheetLength)
geometryGroup.addGeometry(leftProfileModel, {
materials: [new SKYCAD.Material({ color: 0xaaaaaa })]
})

const middleProfileModel = new SKYCAD.ParametricModel()
const middleProfileSketch = ASSETS.STATIC_SKETCHES.SHEET_MIDDLE_PROFILE_DXF
middleProfileModel.addExtrude(middleProfileSketch, refPlane, sheetLength)
geometryGroup.addGeometry(middleProfileModel, {
materials: [new SKYCAD.Material({ color: 0xeeeeee })]
})

const rightProfileModel = new SKYCAD.ParametricModel()
const rightProfileSketch = ASSETS.STATIC_SKETCHES.SHEET_RIGHT_PROFILE_DXF
rightProfileModel.addExtrude(rightProfileSketch, refPlane, sheetLength)
geometryGroup.addGeometry(rightProfileModel, {
materials: [new SKYCAD.Material({ color: 0x777777 })]
})

return geometryGroup
}

Remember that the static sketches keep their coordinate system. In this case, the files were prepared so that they are offset correctly. With other files, you might have to adjust the position and rotation when using them for models or layouts.

If we put this in an app with the parameters mentioned, it could look like this:

Static Models

As a product example, we take a simple smart lightbulb divided in three different models, so that each one can have different colors. Although the models remain the same, we will be able to change the color of the lightbulb and "turn it on and off". You can download the following STL files for each part:

Before being able to use them in your component, you need to import them into your project.

  • Upload all three files to your project in the dashboard under Files. how-to-use-static-assets-models-1

  • Create a Static Model for each file: how-to-use-static-assets-models-2

Now you should be able to use the models within your component in this case.

  • Import ASSETS into your component. how-to-use-static-assets-models-3
  • Add them directly to the geometry group. Here is an example of the geometry group of the lightbulb, based on the two parameter values on and color.
const contactModel = ASSETS.STATIC_MODELS.CONTACT_STL
const bodyModel = ASSETS.STATIC_MODELS.BODY_STL
const bulbModel = ASSETS.STATIC_MODELS.BULB_STL

export function generateLightbulbGeometry(on: boolean, color: SKYCAD.RgbColor) {
const geometryGroup = new SKYCAD.GeometryGroup()

const bulbMaterials = on
? [new SKYCAD.Material({ color: color.toRgbNumber(), opacity: 0.95 })]
: [new SKYCAD.Material({ color: 0xeeeeee, opacity: 0.7 })]

geometryGroup.addGeometry(contactModel, {
materials: [new SKYCAD.Material({ color: 0x444444 })]
})
geometryGroup.addGeometry(bodyModel, {
materials: [new SKYCAD.Material({ color: 0xcccccc })]
})
geometryGroup.addGeometry(bulbModel, {
materials: bulbMaterials
})

return geometryGroup
}

Now each static model should look like the following if they are added in 3D presets: how-to-use-static-assets-models-4

Remember that the static models keep their coordinate system. In this case, the files were prepared so that they are offset from the ground correctly. With other files, you might have to adjust the position and rotation when adding them to the geometry group.

If we put this in an app with the parameters mentioned, it could look like this: