This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/papercraft/openjscad/node_modules/@jscad/scad-api/src/group.js

26 lines
681 B
JavaScript

const {CAG} = require('@jscad/csg')
// FIXME : is this used anywhere ?
function group () { // experimental
let o
let i = 0
let a = arguments
if (a[0].length) a = a[0]
if ((typeof (a[i]) === 'object') && (a[i] instanceof CAG)) {
o = a[i].extrude({offset: [0, 0, 0.1]}) // -- convert a 2D shape to a thin solid, note: do not a[i] = a[i].extrude()
} else {
o = a[i++]
}
for (; i < a.length; i++) {
let obj = a[i]
if ((typeof (a[i]) === 'object') && (a[i] instanceof CAG)) {
obj = a[i].extrude({offset: [0, 0, 0.1]}) // -- convert a 2D shape to a thin solid:
}
o = o.unionForNonIntersecting(obj)
}
return o
}
module.exports = group