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:

🎥 Video on Static Sketches.
🎥 Video on Static Models.

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:

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.

  • Create a Static Sketch for each file:

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

  • Import ASSETS into your component.

  • 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 plane = new SKYCAD.Plane(1, 0, 0, 0)

const leftProfileModel = new SKYCAD.ParametricModel()
const leftProfileSketch = ASSETS.STATIC_SKETCHES.SHEET_LEFT_PROFILE_DXF
leftProfileModel.addExtrude(leftProfileSketch, plane, 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, plane, 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, plane, 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:

E.g. if your static sketches are not visible in the preview, you can check the troubleshooting guide here.

Static Models​

When it comes to 3D models, using files with a reduced file size improves the performance of the app significantly. The formats that DynaMaker can create static models from are:

  • STL: simplified geometry that usually only shows the surface made of polygons or faces.
  • GLB: same as STL but already contains information about textures.

STL 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.

  • Create a Static Model for each file:

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

  • Import ASSETS into your component.

  • 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:

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:


GLB models​

Alternatively you can use GLB formats (models with textures included) if these are for pure visualization. As an example of a static model created from a GLB file of a plant including textures (in the exact same way as if it was a STL model):