How to use the makerjs.cloneObject function in makerjs

To help you get started, weā€™ve selected a few makerjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / maker.js / demos / js / makerjs-spokes-flared.js View on Github external
wedge.paths.innerFillet = innerFilletArc;
        } else {
            wedge.paths.innerFillet1 = makerjs.path.fillet(wedge.paths.ShapeLine1, wedge.paths.Ring_inner, innerFillet);
            wedge.paths.innerFillet2 = makerjs.path.fillet(wedge.paths.ShapeLine5, wedge.paths.Ring_inner, innerFillet);
        }
    }

    if (outerFillet) {
        wedge.paths.outerFillet1 = makerjs.path.fillet(wedge.paths.ShapeLine1, wedge.paths.Ring_outer, outerFillet);
        wedge.paths.outerFillet2 = makerjs.path.fillet(wedge.paths.ShapeLine5, wedge.paths.Ring_outer, outerFillet);
    }

    this.models = {};
    
    for (var i = 0; i < count; i++) {
        var iwedge = makerjs.cloneObject(wedge);
        this.models['wedge' + i] = makerjs.model.rotate(iwedge, i * a, [0, 0]);
    }

    if (addRing) {
        var ringWidth = (spokeWidth + flareWidth) / 2;
        this.models.ring2 = new makerjs.models.Ring(outerRadius + ringWidth, innerRadius - ringWidth);
    }
}
github microsoft / maker.js / demos / js / makerjs-spokes-straight.js View on Github external
wedge.paths.innerFillet = innerFilletArc;
        } else {
            wedge.paths.innerFillet1 = makerjs.path.fillet(wedge.paths.ShapeLine2, wedge.paths.Ring_inner, innerFillet);
            wedge.paths.innerFillet2 = makerjs.path.fillet(wedge.paths.ShapeLine4, wedge.paths.Ring_inner, innerFillet);
        }
    }

    if (outerFillet) {
        wedge.paths.outerFillet1 = makerjs.path.fillet(wedge.paths.ShapeLine2, wedge.paths.Ring_outer, outerFillet);
        wedge.paths.outerFillet2 = makerjs.path.fillet(wedge.paths.ShapeLine4, wedge.paths.Ring_outer, outerFillet);
    }

    this.models = {};
    
    for (var i = 0; i < count; i++) {
        var iwedge = makerjs.cloneObject(wedge);
        this.models['wedge' + i] = makerjs.model.rotate(iwedge, i * a, [0, 0]);
    }

    if (addRing) {
        this.models.ring2 = new makerjs.models.Ring(outerRadius + spokeWidth, innerRadius - spokeWidth);
    }
}

makerjs

Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

Apache-2.0
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis