Skip to main content

How To Create 2D & 3D Exporter

In DynaMaker you can quickly add a button to your product configurator to export 3D visualizations as 3D models, and even create 2D drawings.

3D Exporters​

Your 3D visualizations can be exported in STEP and BIM format. This can be achieved through action-buttons in the UI. For this:

  • Go to Studio > Assembly & Publish.
  • After choosing your configuration and visualization models, under Actions, choose Download STEP and/or Download BIM

These actions will quickly add a button automatically below your configuration model that will allow downloading your visualization in STEP and BIM format.

2D exporters​

You can quickly generate 2D drawings from your visualizations in PDF format. For this:

  • Go to Studio > + New Building Block > Drawing Exporter Building Block.
  • After choosing your configuration and visualization models, under Actions, choose Download STEP and/or Download BIM
tip

Naturally the content of the drawings can be tweaked according to what's needed. Here's an interactive product configurator whose PDF drawings include 4 views, one of them as the isometric projection with different scale:

Check the full code of the drawing exporter for the product configurator above:
export function quoteDrawing(geometry: SKYCAD.GeometryGroup) {
const pageSize = new SKYMATH.Vector2D(297, 210)
const margin = 10

const viewsLayout = new SKYCAD.Layout()

const boundsSize = geometry.getBounds().getSize()

const frontProjectionLayout = SKYCAD.project(geometry, new SKYCAD.Plane(0, -1, 0, 0))
viewsLayout.addLayout(frontProjectionLayout)

const topProjectionLayout = SKYCAD.project(geometry, new SKYCAD.Plane(0, 0, 1, 0))
viewsLayout.addLayout(topProjectionLayout, {
position: { x: 0, y: -200 },
})

const sideProjectionLayout = SKYCAD.project(geometry, new SKYCAD.Plane(-1, 0, 0, 0))
viewsLayout.addLayout(sideProjectionLayout, {
position: { x: 0.5 * boundsSize.x + 100, y: 0 },
})

const drawing = new SKYDRAWING.Drawing()
let pageNr = 1
drawing.addPage(pageNr, {
margin,
pageHeight: pageSize.y,
pageWidth: pageSize.x,
})

const validScales = [1]
for (let i = 2; i < 300; i++) validScales.push(1 / i)

const { scaleLabel, scale } = drawing.addContent(1, viewsLayout, {
fitInside: {
bounds: new SKYCAD.Bounds2D(
new SKYMATH.Vector2D(margin, margin),
new SKYMATH.Vector2D(pageSize.x - 3 * margin, pageSize.y - 3 * margin),
),
validScales,
},
align: { horizontal: 'center', vertical: 'center' },
})

const isoProjectionLayout = SKYCAD.project(geometry, new SKYCAD.Plane(1, 1, 1, 0), { excludeTags: ['dimensions'] })
drawing.addContent(1, isoProjectionLayout, {
position: new SKYMATH.Vector2D(0.9 * pageSize.x, 0.15 * pageSize.y),
scale: 0.5 * scale,
showScale: true,
textSize: 3,
align: { horizontal: 'right', vertical: 'bottom' },
})

const headerLayout = generateHeaderLayout(`${scaleLabel} (A4)`)

drawing.setHeader(pageNr, headerLayout)

return drawing
}

function generateHeaderLayout(scale: string) {
const table = new SKYCAD.Table({ defaultTextSize: 3, columnWidths: [50, 20] })

table.addText('', 0, 0, { rowspan: 3 })
table.addText('mm', 0, 1, { label: 'Units' })

table.addText(scale, 1, 1, { label: 'Scale' })

const dateString = new Date().toISOString().split('T')[0]!
table.addText(dateString, 2, 1, { label: 'Date' })

table.addText('Lift Table', 3, 0, { label: 'Title' })
table.addText(`1 / 1`, 3, 1, { label: 'Page' })

const logo = ASSETS.IMAGES.DYNAMAKER_LOGO

const headerLayout = table.generateLayout()

headerLayout.addImage(logo, {
position: new SKYMATH.Vector2D(2, 8),
scale: 0.045,
})

return headerLayout
}