-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiHelpers.js
32 lines (27 loc) · 1.05 KB
/
apiHelpers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const {CSG} = require('@jscad/csg/api').csg
const addConnector = (name, point, axis, normal, object) => {
const connector = new CSG.Connector(point, axis, normal)
const properties = Object.assign({}, object.properties)
properties[name] = connector
return Object.assign({}, object, properties)
}
const connectTo = (options, object) => {
const {source, target, mirror, rotation} = options
// source & target connector
return object.connectTo(
source, // the servo's pre defined Connector
target, // the connector on the surface
mirror, // we don't want to mirror; the Connector's axes should point in the same direction
rotation // normalrotation; we could use it to rotate the servo in the plane
)
}
const text = (string) => {
const te = vector_text(0, 0, param.name)
/*l.forEach(function (s) {
p.push(rectangular_extrude(s, { w: param.thickness, h: param.thickness }))
})*/
}
module.exports = {
addConnector,
connectTo
}