Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function toDXF(model: MakerJs.IModel, options: MakerJs.exporter.IDXFRenderOptions) {
if (!options.units) {
options.units = model.units || makerjs.unitType.Millimeter;
}
return makerjs.exporter.toDXF(model, options);
}
return toDXF;
function VentgridCircle(filterRadius, spacing, radius) {
this.filterRadius = filterRadius;
this.spacing = spacing;
this.radius = radius;
this.id = 'ventgridcircleInstance';
this.units = makerjs.unitType.Millimeter;
this.paths = {};
this.rim = new makerjs.paths.Circle([0, 0], radius);
var ventgridInstance = new ventgrid(filterRadius, spacing, radius, radius);
for (var id in ventgridInstance.paths) {
var circle = ventgridInstance.paths[id];
this.checkCircle(id, circle);
}
}
VentgridCircle.prototype.checkCircle = function (id, circle) {
var text = makerjs.model.scale(new makerjs_monotext('MAKERJS.ORG'), textScale);
var textW = hCenter(text, textY);
var tabW = textW + tabMargin;
var tab = new makerjs.models.RoundRectangle(tabW, tabHeight, tabR);
hCenter(tab, rim - tabR);
var innerW = w - 2 * rim;
var innerH = h - 2 * rim;
var inner = new makerjs.models.RoundRectangle(innerW, innerH, rim);
inner.origin = [rim, rim];
flipArcs(inner);
this.units = makerjs.unitType.Millimeter;
this.paths = {};
var plus = {
origin: [w / 2, h / 2],
models: {
v: makerjs.model.move(new makerjs.models.Rectangle(conn, h * 2), [conn / -2, -h]),
h: makerjs.model.move(new makerjs.models.Rectangle(w * 2, conn), [-w, conn / -2])
}
}
makerjs.model.rotate(plus, -logoAngle, plus.origin);
this.models = {
text: text,
outer: outer,
bolts: bolts,
function toStl(model, options) {
if (!deps[MakerJsPlaygroundExport.ExportFormat.Stl]) {
importScripts('../../../external/jscad/csg.js', '../../../external/jscad/stl-serializer.js');
deps[MakerJsPlaygroundExport.ExportFormat.Stl] = true;
}
//make sure size is in mm for STL
model = makerjs.model.convertUnits(model, makerjs.unitType.Millimeter);
var CAG = require('@jscad/csg').CAG;
var stlSerializer = require('@jscad/stl-serializer');
options.statusCallback = function (status) {
result.percentComplete = status.progress;
postMessage(result);
};
return makerjs.exporter.toJscadSTL(CAG, stlSerializer, model, options);
}
return toStl;
//make a rectangle around the bolts
var Rect = rounded ? makerjs.models.RoundRectangle : makerjs.models.Rectangle;
var rect = new Rect(bolts, boltMargin);
//save all of these in the model
this.models = {
text: textModel,
rect: rect,
bolts: bolts
};
//move everything to [0, 0]
makerjs.model.zero(this);
this.units = makerjs.unitType.Millimeter;
}