UNPKG

@bitbybit-dev/jscad-worker

Version:

Bit By Bit Developers JSCAD Based CAD Library to Program Geometry Via WebWorker

279 lines (278 loc) 10.1 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; /** * Contains various functions for solid 3D shapes from JSCAD library https://github.com/jscad/OpenJSCAD.org * Thanks JSCAD community for developing this kernel */ export class JSCADShapes { constructor(jscadWorkerManager) { this.jscadWorkerManager = jscadWorkerManager; } /** * Create a 3D cube shape * @param inputs Cube parameters * @returns Cube solid * @group primitives * @shortname cube * @drawable true */ cube(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cube", inputs); }); } /** * Create a 3D cubes on multiple center points * @param inputs Cube with multiple center points parameters * @returns List of cube solids * @group primitives on centers * @shortname cubes * @drawable true */ cubesOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cubesOnCenterPoints", inputs); }); } /** * Create a 3D cuboid shape * @param inputs Cuboid parameters * @returns Cuboid solid * @group primitives * @shortname cuboid * @drawable true */ cuboid(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cuboid", inputs); }); } /** * Create a 3D cuboids on multiple center points * @param inputs Cuboids with multiple center point parameters * @returns List of cuboid solids * @group primitives on centers * @shortname cuboids * @drawable true */ cuboidsOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cuboidsOnCenterPoints", inputs); }); } /** * Create a 3D elliptic cylinder solid * @param inputs Elliptic cylinder parameters * @returns Elliptic cylinder solid * @group primitives * @shortname cylinder elliptic * @drawable true */ cylinderElliptic(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cylinderElliptic", inputs); }); } /** * Create a 3D elliptic cylinders on multiple center points * @param inputs Elliptic cylinders with multiple center point parameters * @returns List of elliptic cylinders solids * @group primitives on centers * @shortname cylinder elliptic * @drawable true */ cylinderEllipticOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cylinderEllipticOnCenterPoints", inputs); }); } /** * Create a 3D cylinder solid * @param inputs Cylinder parameters * @returns Cylinder solid * @group primitives * @shortname cylinder * @drawable true */ cylinder(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cylinder", inputs); }); } /** * Create a 3D cylinders on multiple center points * @param inputs Cylinders with multiple center point parameters * @returns List of cylinder solids * @group primitives on centers * @shortname cylinder * @drawable true */ cylindersOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.cylindersOnCenterPoints", inputs); }); } /** * Create a 3D ellipsoid solid * @param inputs Ellipsoid parameters * @returns Ellipsoid solid * @group primitives * @shortname ellipsoid * @drawable true */ ellipsoid(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.ellipsoid", inputs); }); } /** * Create a 3D ellipsoids on multiple center points * @param inputs Ellipsoid parameters with multiple center points * @returns List of ellipsoid solids * @group primitives on centers * @shortname ellipsoid * @drawable true */ ellipsoidsOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.ellipsoidsOnCenterPoints", inputs); }); } /** * Create a 3D geodesic sphere solid * @param inputs Geodesic sphere parameters * @returns Geodesic sphere solid * @group primitives * @shortname geodesic sphere * @drawable true */ geodesicSphere(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.geodesicSphere", inputs); }); } /** * Create a 3D geodesic spheres on multiple center points * @param inputs Geodesic sphere parameters with multiple center points * @returns List of geodesic spheres * @group primitives on centers * @shortname geodesic sphere * @drawable true */ geodesicSpheresOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.geodesicSpheresOnCenterPoints", inputs); }); } /** * Create a 3D rounded cuboid solid * @param inputs Rounded cuboid parameters * @returns Rounded cuboid solid * @group primitives * @shortname rounded cuboid * @drawable true */ roundedCuboid(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.roundedCuboid", inputs); }); } /** * Create a 3D rounded cuboids on multiple center points * @param inputs Rounded cuboids parameters with multiple center points * @returns List of rounded cuboids * @group primitives on centers * @shortname rounded cuboid * @drawable true */ roundedCuboidsOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.roundedCuboidsOnCenterPoints", inputs); }); } /** * Create a 3D rounded cylinder solid * @param inputs Rounded cylinder parameters * @returns Rounded cylinder solid * @group primitives * @shortname rounded cylinder * @drawable true */ roundedCylinder(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.roundedCylinder", inputs); }); } /** * Create a 3D rounded cylinders on multiple center points * @param inputs Rounded cylinders parameters with multiple center points * @returns List of rounded cylinders * @group primitives on centers * @shortname rounded cylinder * @drawable true */ roundedCylindersOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.roundedCylindersOnCenterPoints", inputs); }); } /** * Create a 3D sphere solid * @param inputs Sphere parameters * @returns Sphere solid * @group primitives * @shortname sphere * @drawable true */ sphere(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.sphere", inputs); }); } /** * Create a 3D sphere on multiple center points * @param inputs Sphere parameters with multiple center points * @returns List of spheres * @group primitives on centers * @shortname sphere * @drawable true */ spheresOnCenterPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.spheresOnCenterPoints", inputs); }); } /** * Create a 3D torus solid * @param inputs Torus parameters * @returns Torus solid * @group primitives * @shortname torus * @drawable true */ torus(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.torus", inputs); }); } /** * Create a 3D shape from poylgon points that have to be nested arrays of points * @param inputs points * @returns shape * @group shapes * @shortname from polygon points * @drawable true */ fromPolygonPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.jscadWorkerManager.genericCallToWorkerPromise("shapes.fromPolygonPoints", inputs); }); } }