Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* title : Chain Hull
// author : Rene K. Mueller, Moissette Mark
// license : MIT License
// date : 2013/04/18
// description: Whosa whatsis suggested "Chain Hull" as described at
// https://plus.google.com/u/0/105535247347788377245/posts/aZGXKFX1ACN
*/
const { sin, cos } = Math
const { circle } = require('@jscad/modeling').primitives
const { translate, scale } = require('@jscad/modeling').transforms
const { union } = require('@jscad/modeling').booleans
const { hullChain } = require('@jscad/modeling').hulls
const { extrudeLinear } = require('@jscad/modeling').extrusions
const main = () => {
const shell = []
const hexagon = []
for (let i = 0; i < 12; i++) { // -- shell like
const x = sin(i / 12 * 180) * 10
const y = cos(i / 12 * 180) * 10
shell.push(
translate([x, y, 0], scale(6 - i / 2, circle())) // { center: true }
)
}
const n = 6
/* title : Stepper Motor
// author : Derrick Oswald
// license : MIT License
// description: a simple stepper motor design
// tags: extrusion, extrudeFromSlices, slices
*/
const { circle, cube, cylinder } = require('@jscad/modeling').primitives
const { color } = require('@jscad/modeling').color
const { translate, rotateX } = require('@jscad/modeling').transforms
const { extrudeFromSlices, slice } = require('@jscad/modeling').extrusions
const { mat4 } = require('@jscad/modeling').math
const { union, intersect } = require('@jscad/modeling').booleans
const { sqrt } = Math
const { degToRad } = require('@jscad/modeling').math
const getParameterDefinitions = () => {
return ([
{ name: 'motorBody_len', type: 'float', initial: 47.5, step: 0.5, caption: 'Motor length' },
{ name: 'motorBody_width', type: 'float', initial: 42.0, step: 0.5, caption: 'Motor width' },
{ name: 'motorBody_chamfer', type: 'float', initial: 5.0, step: 0.1, caption: 'Motor chamfer' },
{ name: 'motorCap_len', type: 'float', initial: 8.0, step: 0.1, caption: 'Motor cap length' },
{ name: 'motorCap_thickness', type: 'float', initial: 1.0, step: 0.1, caption: 'Motor cap thickness' },
{ name: 'motorCap_chamfer', type: 'float', initial: 2.5, step: 0.1, caption: 'Motor cap chamfer' },
{ name: 'shaft_len', type: 'float', initial: 22.0, step: 0.5, caption: 'Shaft length' },
{ name: 'shaft_radius', type: 'float', initial: 2.5, step: 0.1, caption: 'Shaft radius' },
/* title : Expand
// author : OpenSCAD.org, adapted by Rene K. Mueller
// license : MIT License
// description: expand() function
*/
const { geom2, geom3, line2, path2 } = require('@jscad/modeling').geometry
const { cuboid, cylinder } = require('@jscad/modeling').primitives
const { translate, scale } = require('@jscad/modeling').transforms
const { union, difference } = require('@jscad/modeling').booleans
const { expand } = require('@jscad/modeling').expansions
const { color } = require('@jscad/modeling').color
const main = () => {
// you can expand 2d paths
const points = [
[10, 0],
[9.510565162951535, 3.090169943749474],
[8.090169943749475, 5.877852522924732],
[5.877852522924732, 8.090169943749475],
[3.0901699437494745, 9.510565162951535],
[6.123233995736766e-16, 10]
]
const path2Example = color('black',
path2.fromPoints({ }, points) // it also works with ccw points ie points.reverse()
)