Skip to main content

SKYCAD

This library handles everything related to 2D & 3D geometry, such as:


Plane

A plane can be used to place a sketch in the world or for different 3D operations.

How To Create A Plane

const plane = SKYCAD.Plane(nX, nY, nZ, offset)

Here, nX , nY and nZ are the coordinates of the normal vector n and offset the distance from the origin.

Things To Consider

  • A plane is not visible in the world
  • A plane has its own local coordinate system X'Y'Z'
  • n does not need to be a unit vector
  • offset handles negative values
  • θ is defined from the xy-projection of the plane towards the negative y-axis

Uses

  • 3D operations:
model.addExtrude(sketch, plane, extrudeLength)
  • Projections 2D:
const sketch = model.generateProjection(plane).visible

Trigonometry: Offset, Θ And Φ

Being n the normal vector as plane.n :

const offset = plane.offset
const theta = SKYCAD.computeAngleTheta(n)
const phi = SKYCAD.computePhiAngle(n)

Examples

Sketch

2D Sketches is a very important part of parametric CAD. Below we have listed the basics.

How To Create A Sketch

By Moving The Marker

const myTriangleSketch = new SKYCAD.Sketch()
myTriangleSketch.moveTo(0, 0)
myTriangleSketch.lineTo(100, 0)
myTriangleSketch.curveTo(100, 50, { clockwise: true })
myTriangleSketch.lineToId(0)

lineToId(0) ensures a closed path by going to the node 0 with a line. Useful to avoid possible bugs in 3D geometries. Same applies for curveToId(0).

All curves are counter-clockwise defined by default (clockwise: false).

By Node Reference

const myTriangleSketch = new SKYCAD.Sketch()
const n0 = myTriangleSketch.addNode(0, 0)
const n1 = myTriangleSketch.addNode(100, 0)
const n2 = myTriangleSketch.addNode(100, 50)

myTriangleSketch.addLine(n0, n1)
myTriangleSketch.addCurve(n1, n2)
myTriangleSketch.addLine(n2, n0)

curveTo

In DynaMaker a curve can be treated as a Quadratic Bézier curve, which is defined by 3 points (start, end and control) and their weights (defining the degree of tangency). Combining these properties, each point (A, B, etc) can be drawn using De Casteljau's algorithm, resulting in the desired curve.

There are different optional arguments to use in sketch.curveTo():

  • radius of the curve.
  • clockwise as a boolean to set the curve clockwise (true) or counterclockwise (false).
  • controlPosition as control, defining the tangency towards the start and end of the curve
  • controlPositionWeight to set the weight of the point control.
  • startNodeWeight to set the weight of the point start.
  • startNodeWeight to set the weight of the point end.
  • fromNodeId to specify from which point id the curve should start

Examples of use:

// Most common
sketch.curveTo(0, 10, { radius: 3.5, clockwise: false })
// Typical quadratic Bézier curve
sketch.curveTo(0, 10, {
controlPosition: new SKYMATH.Vector2D(20, 20),
controlPositionWeight: 0.5,
startNodeWeight: 2,
endNodeWeight: 0.1,
})

Geometric Transformations

sketch.translate(5, 5) // 2D translation as (X, Y)
sketch.rotate(Math.PI / 4) // [rad], rotation around the origin (0, 0) of the sketch
sketch.scale(10) // scales the skech from its center, negative values are also accepted
const clonedSketch = sketch.clone() // creates a copy

Rotation & translation are cumulative operations. If you write sketch.translate(1, 3) and after sketch.translate(-5, 10), this will result in sketch.translate(-4, 13). Same applies for rotation.

Chamfer & Fillet

const sketch = new SKYCAD.Sketch()
const n0 = sketch.addNode(0, 0)
const n1 = sketch.addNode(100, 0)
const n2 = sketch.addNode(50, 100)

sketch.addLine(n0, n1)
sketch.addLine(n1, n2)
sketch.addLine(n2, n0)

const size = 10
sketch.addChamfer(size, n0)
sketch.addFillet(size, n1)

Fillets and chamfers are easiest when applied last

Offset Sketch

An offset sketch can be created from another by generating shapes. As an example:

const shape = exampleSketch.generateShapes()[0]
const offsettedShape = SKYCAD.generateShapesWithOffset(shape, offset)[0]
const offsettedSketch = offsettedShape.generateSketch()

Sketch From Bounds

const sketch = SKYCAD.generateSketchFromBounds(bounds2D) // generates a rectangular sketch from SKYCAD.Bounds2D

Sketch From Text (with font)

const sketch = SKYCAD.generateSketchFromText('ABCDEF', {
align: 'center',
textSize: 50,
font: ASSETS.DATASETS.CUSTOM_FONT
})

In order to use your custom font, you need to have it as a JSON file and then create a dataset so it becomes easily useable within DynaMaker. Typically the font files are in TTF format, in order to convert them to JSON:

  • go to https://gero3.github.io/facetype.js/.
  • select JSON format for the output file.
  • to decrease significantly the size of the output file, select Restrict character set and include the following accepted characters:
    abcdefghijklmnopqrstuvwxyzåäö ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ0123456789!?:;-_,.<>|*-+'"`@#$€§½²³()[]{}=/%&°øرμ
  • then go to your app dashboard.
  • upload the JSON font files under Files.
  • create datasets for each of your custom fonts under Datasets.

As an example of using this function in a simple model with text:

Remember that SKYCAD.generateSketchFromText() generates a sketch, therefore it can be used for models.

Boolean Operations

Boolean operations can be done between sketches. Create a new sketch as a result of a boolean operation as:

const unionSketch = SKYCAD.generateSketchUnion(sketchA, sketchB)
const subtractionSketch = SKYCAD.generateSketchSubtraction(sketchA, sketchB)
const intersectionSketch = SKYCAD.generateSketchIntersection(sketchA, sketchB)

Example

If you want to merge two different sketches into a single one, regardless of their interaction, you should do sketchA.mergeSketch(sketchB) instead.

isSketch

const isItemSketch = SKYCAD.isSketch(item) // returns true if item is a SKYCAD.Sketch

Layout

Layouts are used to compose 2D content to be displayed in the application or in drawings.

Example

A layout with a sketch, dimension and text element:

const layout = new SKYCAD.Layout()

const squareSketch = SKYCAD.generateRectangleSketch(0, 0, 300, 300)
layout.addSketch(squareSketch)

const startNode = new SKYMATH.Vector2D(0, 300)
const endNode = new SKYMATH.Vector2D(300, 300)
layout.addDimension(startNode, endNode, { decimals: 0, offset: 40 })

layout.addText('DynaMaker', { align: 'center', position: new SKYMATH.Vector2D(150, 150), size: 20 })

How To Create A Layout

const layout = new SKYCAD.Layout()

Content

The following content types can be added to a layout:

Sketches

layout.addSketch(sketch)
layout.addSketch(sketch: SKYCAD.Sketch, args?: {
anchor?: string, // default:
position?: SKYMATH.Vector2D, // default:
rotation?: number, // default: 0
scale?: number, // default: 1
}): void

Dimensions

const p1 = new SKYMATH.Vector2D(0, 0)
const p2 = new SKYMATH.Vector2D(1000, 0)
layout.addDimension(p1, p2)
layout.addDimension(startPos: SKYMATH.Vector2D, endPos: SKYMATH.Vector2D, args?: {
decimals?: number, // default:
offset?: number, // default:
textSize?: number, // default:
textRotation?: number, // default: 0
}): void

Text

layout.addText('DynaMaker')
layout.addText(text: string, args?: {
align?: string, // default: 'left'
anchor?: string, // default:
position?: SKYMATH.Vector2D, // default:
rotation?: number, // default: 0
size?: number, // default: 1
}): void

Images

const img = document.createElement('img')
img.src = '...' // url to img
layout.addImage(img)
layout.addImage(image: HTMLImageElement, args?: {
anchor?: string, // default:
position?: SKYMATH.Vector2D, // default:
rotation?: number, // default: 0
scale?: number, // default: 1
}): void

Layouts

layout.addLayout(otherLayout)
layout.addLayout(layout: SKYCAD.Layout, args?: {
anchor?: string, // default:
position?: SKYMATH.Vector2D, // default:
rotation?: number, // default: 0
}): void

Content Geometric Transformations

layout.rotateContent(Math.PI / 4) // [rad], rotation around the origin (0, 0) of the sketch
layout.scaleContent(4) // scales the content, negative values are also accepted
layout.translateContent(5, -3) // 2D translation of content as (X,Y)
const clonedLayout = layout.clone() // creates a copy

Anchor Positions

Anchor positions allows easy positioning of elements within a layout without knowing the exact coordinates. Anchors can be added to a layout by defining a unique id and a position.

layout.addAnchor(id: string, position: SKYMATH.Vector2D): void

isLayout

const isItemLayout = SKYCAD.isLayout(item) // returns true if item is a SKYCAD.Layout

Bounds

We defined the bounds as an object containing the position of two corners.

How To Create Bounds

const bounds2D = new SKYCAD.Bounds2D(
new SKYMATH.Vector2D(1, 3),
new SKYMATH.Vector2D(10, -7)
)

const bounds3D = new SKYCAD.Bounds3D(
new SKYMATH.Vector3D(1, 3, -5),
new SKYMATH.Vector3D(10, -7, 8)
)

Get Bounds

const sketchBounds2D = sketch.getBounds()
const layoutBounds2D = layout.getBounds()
const modelBounds3D = model.getBounds()
const geometryBounds3D = geometryGroup.getBounds()

Geometric Transformations

const clonedBounds = bounds.clone() // creates a copy
bounds.translate(exampleVector) // translation as new SKYMATH.Vector2D(X, Y)
bounds.offset(10) // extends the bounds 10 mm from the center

Other

const size = bounds.getSize() // gives the width (x) and height (y) as: { x: number, y: number }
const centerPosition = bounds.getCenter() // gives the center position
const mergedBounds2D = SKYCAD.mergeBounds2D([bounds2D_A, bounds2D_B, ...]) // merges all 2D bounds into a single SKYCAD.Bounds2D
const mergedBounds3D = SKYCAD.mergeBounds3D([bounds3D_A, bounds3D_B, ...]) // merges all 3 bounds into a single SKYCAD.Bounds3D
const mergedBounds2D = SKYCAD.mergeBounds2D([bounds2D_A, bounds2D_B, ...]) // merges all 2D bounds into a single SKYCAD.Bounds2D
const mergedBounds3D = SKYCAD.mergeBounds3D([bounds3D_A, bounds3D_B, ...]) // merges all 3 bounds into a single SKYCAD.Bounds3D

Collision Detection Booleans

const isPositionInsideBounds = bounds.checkPositionInside(position)
const isBoundsAInsideBoundsB = boundsA.isFullyInsideBounds(boundsB)
const isOverlapping = boundsA.isOverlappingBounds(boundsB, { treatTangencyAsOverlap: true })

For the second case of isOverlappingBounds() , the result depends on treatTangencyAsOverlap , which is set to true by default.

Table

Tables are great for displaying organized data, such as BOM-lists or headers for your drawings.
A table can contain text, images and sketches and any cell can span any number of rows and columns.

Example

const table = new SKYCAD.Table({ defaultTextSize: 10, width: 400 })

table.addText('1', 0, 1)
table.addText('2', 0, 2)
table.addText('3', 0, 3)

table.addText('Row 1: Left', 1, 0, { align: 'left' })
table.addText('Row 2: Center', 2, 0)
table.addText('Row 3: Right', 3, 0, { align: 'right' })

table.addText('1x2', 1, 1, { colspan: 2, label: 'Cell Label 1' })
table.addText('2x2', 2, 1, { colspan: 2, rowspan: 2, label: 'Cell Label 2' })

table.addSketch(SKYCAD.generateCircleSketch(5, 5, 10), 0, 0)

const tableLayout = table.generateLayout()

tableLayout.addImage(ASSETS.IMAGES.SKYMAKER_LOGO, { position: new SKYMATH.Vector2D(380, 20) })

Notice that the table is converted to a layout with table.generateLayout(), so it can be added later to other layouts or drawings.

How To Create A Table

Create a table as:

const table = new SKYCAD.Table({
defaultTextSize: number, // default: 10
width: number, // default: 512
})

A table can be converted into a sketch by using const layout = table.generateLayout().

The cell size is defined dynamically with its content. The rows and columns of a table will always stretch to fill the full width of the table.

Content

Content is added into a specific row and column. Supported content types are text, images and sketches.

Table coordinates are 0 indexed. (0, 1) corresponds to first row and second column

Text

// adding 'some text' to the second cell on the first row
table.addText('some text', 0, 0)
table.addText(text: string, row: number, column: number, {
label?: string, // default: ''
colspan?: number, // default: 1, nr of columns to cover
rowspan?: number, // default: 1, nr of rows to cover
align?: string, // default: 'left', ['left', 'center', 'right']
}): void

Sketches

  // adding a sketch to the second cell on the first row
table.addSketch(sketch, 0, 0)
table.addSketch(sketch: SKYCAD.Sketch, row: number, column: number, {
label?: string, // default: ''
colspan?: number, // default: 1, nr of columns to cover
rowspan?: number, // default: 1, nr of rows to cover
}): void

isTable

const isItemTable = SKYCAD.isTable(item) // returns true if item is a SKYCAD.Table

Parametric Model

A parametric model is a pure 3D representation, without any information about its material or position. Create a model as:

const model = new SKYCAD.ParametricModel()

CAD Features

In DynaMaker there are 6 CAD features available

Extrusion

model.addExtrude(sketch, plane, extrusionLength)

Cut

model.addExtrudeCut(sketch, plane, extrusionCutLength)

Revolve

model.addRevolve(sketch, plane, {
axisDirection: new SKYMATH.Vector2D(0, -1),
revolveAngle: 235 * Math.PI / 180
})

The following examples use the same sketch and reference plane:

const model = new SKYCAD.ParametricModel()
const sketch = SKYCAD.generateLogo()
const plane = new SKYCAD.Plane(1, 0, 0, 0)

Union

cubeModel.union(sphereModel) // adds sphere to cube, modifying cubeModel

Subtract

cubeModel.subtract(sphereModel) // removes sphere from cube, modifying cubeModel

Split

const model = new SKYCAD.ParametricModel()
const sketch = SKYCAD.generateLogo()
const extrusionPlane = new SKYCAD.Plane(1, 0, 0, 0)
model.addExtrude(sketch, extrusionPlane, 100)

const splitPlane = new SKYCAD.Plane(1.5, 0, -1, 25)
model.addSplit(splitPlane, { keepInside: false, keepOutside: true })

Inside and Outside is defined according to the direction of the normal of splitPlane.

Mesh Model

A mesh model is a collection of vertices, edges and faces that defines the shape of a polyhedral object of an imported file (e.g. stl).

Like a parametric model it lacks the information about its material or position. However, a mesh model also lacks bounds when imported. You can add them when creating the mesh model if you know them or use an open source stl viewer to retrieve them automatically.

const meshModel = new SKYCAD.MeshModel(ASSETS.URLS.MY_STL, {
bounds: new SKYCAD.Bounds3D(
new SKYMATH.Vector3D(0, 0, 0),
new SKYMATH.Vector3D(50, 20, 100),
)
})

Having bounds in a mesh model is useful when updating the camera, for collision detection with other existing models, selection handling and more.

Example - Bike Wheel

Here is a complete example that uses mesh models, together with materials and a container for the models called geometry group.

// Rim component geometry
generateGeometry() {
const geometryGroup = new SKYCAD.GeometryGroup()
const model = new SKYCAD.MeshModel(ASSESTS.URLS.RIM_STL)
geometryGroup.addGeometry(model, { materials: [new SKYCAD.Material({ color: 0x333333 })] })
return geometryGroup
}
// Tyre component geometry
generateGeometry() {
const geometryGroup = new SKYCAD.GeometryGroup()
const model = new SKYCAD.MeshModel(ASSESTS.URLS.TYRE_STL)
geometryGroup.addGeometry(model, { materials: [new SKYCAD.Material({ color: 0xfbfbf0 })] })
return geometryGroup
}
// Wheel component
export class WheelComponent {
private componentHandler = new STUDIO.ComponentHandler()

constructor() {
this.componentHandler = new STUDIO.ComponentHandler()
this.componentHandler.add(new RIM.Component())
this.componentHandler.add(new TYRE.Component())
}

generateGeometry() {
const geometryGroup = this.componentHandler.generateAllGeometry()
return geometryGroup
}
}

Instead of creating a mesh model like const rimModel = new SKYCAD.MeshModel(ASSESTS.URLS.RIM_STL), you can also create a static model directly like const rimModel = ASSESTS.STATIC_MODELS.RIM_STL. The difference between both is that a static model includes the 3D bounds (useful e.g. for collision detection or camera centering), whereas a mesh model lacks this information and therefore must be defined in its definition as seen before. You can read more in this how-to example to see how to create static models efficiently.

Connector

A 3D connector is a point in the world with its own coordinate system. It can be defined by the position and rotation vectors.

const myConnector = new SKYCAD.Connector3D({
position: new SKYMATH.Vector3D(50, 100, 0),
rotation: new SKYMATH.Vector3D(Math.PI / 2, Math.PI / 4, 0),
})

Connectors can be used in different ways. However, check their most common use in this how-to example with a robotic arm.

Color

In DynaMaker it is possible to work with different color systems:

Hexadecimal

JavaScript/TypesSript can already handle hexadecimals colors, so does DynaMaker.

Create a hexadecimal color by just adding 0x before the 6 digits/letters that define the color.

const hexColor = 0xFFFFFF

If you try to console.log() white as 0xFFFFFF and you will see that it automatically returns the decimal color 16777215. Also, notice that 0xFFFFFF === 16777215 returns true so both definitions (hexadecimal and decimal) can be used interchangeably without any problem. See other examples here.

You can convert a hexadecimal color to RGB (and use other functions) with:

const rgbColor = SKYCAD.parseColor(0xffffff) // returns SKYCAD.RgbColor

RGB

Create a RGB color with values from 0 to 255, with alpha to represent its opacity (from 0 to 1) as:

const rgbColor = new SKYCAD.RgbColor(0, 125, 255, { alpha: 0.2 }) // light blue
const clonedRgbColor = rgbColor.clone() // creates a copy
const isSameRgbColor = rgbColorA.equals(rgbColorB) // returns true if rgbColorA is rgbColorB, ignoring alpha
const alpha = rgbColor.getAlpha() // gets the value of alpha
const rgbArray = rgbColor.toRgbArray() // returns list of values from 0 to 255 as [R, G, B]
const cmykArray = rgbColor.toCmykArray() // returns list of values from 0 to 100 as [C, M, Y, K]
const hexadecimalColor = rgbColor.toRgbNumber() // returns a hexadecimal color
const hexadecimalColorString = rgbColor.toHexString() // returns a hexadecimal color as string with # before the 6 digits/letters (e.g. '#FFFFFF')
const isItemRgbColor = SKYCAD.isRgbColor(item) // returns true if item is SKYCAD.RgbColor

CMYK

Create a CMYK color with values from 0 to 100, with alpha to represent its opacity (from 0 to 1) as:

const cmykColor = new SKYCAD.CmykColor(100, 50, 0, 0, { alpha: 0.3 }) // light blue
const clonedCmykColor = cmykColor.clone() // creates a copy
const isSameCmykColor = cmykColorA.equals(cmykColorB) // returns true if cmykColorA is cmykColorB, ignoring alpha
const alpha = cmykColor.getAlpha() // gets the value of alpha
const cmykArray = cmykColor.toCmykArray() // returns list of values from 0 to 100 as [C, M, Y, K]
const hexadecimalColor = cmykColor.toRgbNumber() // returns a hexadecimal color
const hexadecimalColorString = cmykColor.toHexString() // returns a hexadecimal color as string with # before the 6 digits/letters (e.g. '#FFFFFF')
const isItemCmykColor = SKYCAD.isCmykColor(item) // returns true if item is SKYCAD.CmykColor

RAL

In DynaMaker RAL colors (used mainly in the industry for varnish, powder coating and plastics) are treated as numbers as well. Since it is a color system difficult to produce, RAL colors in websites are close representations of their true color.

The main use of RAL colors In DynaMaker is in the RAL color parameter, which always operates in RAL colors (i.e. input and output as 4 digits). For example the RAL color Yellow orange can be represented as 2000.

Any other purpose, like color in sketches, models, etc, needs to follow the other mentioned color systems.

Material

Materials are added to models when added to the geometry groups. Create a material by using some of the most common optional arguments:

  • color as hexadecimal or RGB.
  • opacity as a value from 0 (for transparent) to 1 (for opaque).
  • surfaceGroup to set the side of the CAD feature the material is applied to.
  • surfaceIndexList to set the surface indeces of the CAD feature the material is applied to.
  • metallness as a value from 0 (for plastic) to 1 (for metal) to change how intense the light is reflected in the surfaces.
  • roughness as a value from 0 (for smooth) to 1 (for rough) to change how smooth the light is reflected in the surfaces.

Most common examples:

const material = new SKYCAD.Material({ color: 0x445464, opacity: 0.7 })
const materials = [material]
geometryGroup.addGeometry(myModel, { materials })

const steelMaterial = new SKYCAD.Material({ color: 0xCCCCCC, metalness: 0.5, roughness: 0.1 })
const metallicMaterials = [steelMaterial]
geometryGroup.addGeometry(mYmodel, { materials: metallicMaterials })

const baseMaterial = new SKYCAD.Material({ color: 0xFF0000, surfaceGroup: SKYCAD.SURFACE_GROUP.BASE })
const sideMaterial = new SKYCAD.Material({ color: 0xFF0000, surfaceGroup: SKYCAD.SURFACE_GROUP.SIDE })
const topMaterial = new SKYCAD.Material({ color: 0xFF0000, surfaceGroup: SKYCAD.SURFACE_GROUP.TOP })
const multipleMaterials = [baseMaterial, sideMaterial, topMaterial]
geometryGroup.addGeometry(mYmodel, { materials: multipleMaterials })

With Textures

There are some extra optional arguments of a SKYCAD.Material that are meant for textures:

  • textureId to refer to the texture from Files from the app dashboard.
  • textureWidth to change the widthwise size of the texture.
  • textureHeight to change the heightwise size of the texture.
  • textureOffset to move the texture with an offset (e.g. in case you want to match an edge with the model).
  • textureRotation to rotate the texture with an angle (in radians).
  • textureRotationCenter to set the point to rotate the texture around (as SKYMATH.Vector2D).

Most common example:

const materialsWithTextures = [new SKYCAD.Material({ textureId: ASSETS.TEXTURES.WOOD })]

Check the how-to example to how to add textures in detail.

Geometry Group

Whenever you have multiple models that belong together, e.g. a door blade and its door handle, you can put them in the same GeometryGroup. You can then position, rotate and scale the group as one unit without having to fiddle with its internal structure.

const doorGeometryGroup = new SKYCAD.GeometryGroup()
doorGeometryGroup.addGeometry(doorBladeModel, {
position: new SKYMATH.Vector3D(-100, 100, 0),
rotation: new SKYMATH.Vector3D(Math.PI / 2, 0, 0),
materials: [ new SKYCAD.Material({ color: 0x445464, opacity: 0.3 }) ]
scale: 1
})
doorGeometryGroup.addGeometry(doorHandleModel, {
position: new SKYMATH.Vector3D(0, 100, 0),
materials: [ new SKYCAD.Material({ color: 0x25ADF3, opacity: 0 }) ]
})

Changing the position of geometry makes all its members follow the new position. This is ideal if you want to move subgroups of geometries. Eg. doorGeometryGroup, containing the door blade and handle models, could be within houseGeometryGroup.

2D Projections

2D projections are created via geometry. Given a plane, create a projection as follows with these optional argumens:

  • excludeTags as a list of strings to exclude all geometries and components with those tags for the projection (time-saving!)
  • sectionView as a bolean to cut or not the geometry if the plane goes through it
  • invertSectionView as a bolean select which side of the cut you want to show (only applies if sectionView: true)
const componentGeometry = component.generateGeometry()
const projection = componentGeometry.generateProjection(plane, {
excludeTags: ['screw', 'nuts'],
sectionView: true,
invertSectionView: false,
})

The result of a projection is then:

  • visibleas a sketch with all the visible lines from that plane.
  • hidden as a sketch with all the hidden lines from that plane.
  • connectors as a list of all the connectors in the new sketch (e.g. useful for placing new dimensions)

Remember that generating a projection depends heavily on what's to project. So the more complex geometries you have, the more time it will take for the algoritm to detect what it's behind and so on. Therefore if you are experiencing long loading times when doing projections you can:

  • A. Reduce model complexity: keep sketches and models simple (avoid holes or curves when barely visible). If you need the 3D details for the app, it might be worthy to have 2 functions for generating geometry: one with details for the app, and another without them for the drawing.
  • B. Remove what you don't need in your drawings by using excludeTags (e.g. screws of 1cm in a 10m product might be irrelevant). Remember that removing models saves a lot of time since they are skipped completely.
  • C. Use sketches instead: if you already have sketches that represent perfectly your component, why would you need projections then? Although it might take time to implement, this alternative is way faster than a projection.
  • D. Use pictures from the app instead of projections when a projection doesn't add any extra value, e.g. an isometric view with no dimensions. Since this a special solution, contact support@dynamaker.com so we can guide you how to do it.

Tags

Track the geometry group easier by using tags as:

geometryGroup.addTag('door') // tags the geometry with the string 'door'
const hasDoorTag = geometryGroup.hasTag('door') // returns true if geometryGroup has the given tag 'door'
const tags = geometryGroup.getTags() // returns a list of the tags as strings

Having tags in your geometry makes it easier if you want to skip certains parts of a model for a projection for example. Doing so, a projection will take significantly less time since it completely ignores that geometry for the calculation. Another way to add a tag for each subgeometry of a geometry group could be done as follows:

geometryGroup.addGeometry(doorModel, { tags: ['door'] })
geometryGroup.addGeometry(doorHandleModel, { tags: ['handle'] })
geometryGroup.addGeometry(doorHingesModel, { tags: ['hinge'] })
const projection = geometryGroup.generateProjection(plane, { excludeTags: ['handle', 'hinge'] })

If you want to ignore a whole component for a projection, you don't need to tag all parts of it's geometry. It is enough with tagging the component when adding it to the component handler, so that the instance contains the tag. Of course, you can indistinctly combine tags in geometry and tags in components for projections. You can read more about tags in components here with other uses like removing or getting certain components.

Geometric Transformations

const scale = geometryGroup.getScale() // gets scale as number
const position = geometryGroup.getPosition() // gets position as SKYMATH.Vector3D
const rotation = geometryGroup.getRotation() // gets rotation as SKYMATH.Vector3D
geometryGroup.setPosition(new SKYMATH.Vector3D(1, 10, -7))
geometryGroup.setRotation(new SKYMATH.Vector3D(0, 0, Math.PI / 2))
geometryGroup.setScale(0.7)

Other

const clonedGeometryGroup = geometryGroup.clone() // creates a copy
const isGeometryEmpty = geometryGroup.isEmpty() // returns true if no models/geometry was added with addGeometry()
const geometries = geometryGroup.getGeometry() // returns a list of geometries and models added