UNPKG

@achirita/blox

Version:

A CAD library for building 3D models in the browser.

92 lines (91 loc) 3.83 kB
import { Edge, Vertex, Face, Solid } from './index'; export class Wire { /** * Creates a new `Wire` from the provided edges. * @param {...Edge} edges - The edges to create the wire from. * @returns {Wire} A new `Wire` object created from the provided edges. */ static fromEdges(...edges: Edge[]): Wire; /** * Creates a loft between the wires or points to form a 3D solid. * @param {Object} parameters - Loft parameters. * @param {Vector} [parameters.start] - The starting point of the loft. * @param {Face[]} parameters.wires - Wires to include in the loft. * @param {Vector} [parameters.end] - The ending point of the loft. * @returns {Solid} A new `Solid` object representing the lofted result. */ static loft({ start, wires, end }: { start?: Vector; wires: Face[]; end?: Vector; }): Solid; constructor(wrapped: any); /** * Returns the wrapped OpenCascade object. * @private */ private get wrapped(); /** * Retrieves all edges of the wire. * @returns {Edge[]} An array of `Edge` objects representing the edges of the wire. */ get edges(): Edge[]; /** * Retrieves all vertices of the wire. * @returns {Vertex[]} An array of `Vertex` objects representing the vertices of the wire. */ get vertices(): Vertex[]; /** * Checks if the wire is closed. * @returns {boolean} `true` if the wire is closed, `false` otherwise. */ get isClosed(): boolean; /** * Sweeps the specified profile along this wire to create a 3D solid. * If the wire has sharp edges use transitionMode = "right". * If the wire is C1 continuous use transitionMode = "transformed". * @param {Object} parameters - Sweep parameters. * @param {Face|Wire} parameters.profile - Profile to sweep along the wire. * @param {Wire} [parameters.rail=null] - The guiding rail for the sweep. * @param {('transformed'|'right'|'round')} [parameters.transitionMode="right"] - The transition mode for the sweep. * @returns {Solid} A new `Solid` object representing the swept result. */ sweep({ profile, rail, transitionMode }: { profile: Face | Wire; rail?: Wire; transitionMode?: ("transformed" | "right" | "round"); }): Solid; /** * Sweeps the specified profiles along this wire to create a 3D solid. * If the wire has sharp edges use transitionMode = "right". * If the wire is C1 continuous use transitionMode = "transformed". * @param {Object} parameters - Sweep parameters. * @param {Wire[]} parameters.profiles - Profiles to sweep along the wire. * @param {Wire} [parameters.rail=null] - The guiding rail for the sweep. * @param {('transformed'|'right'|'round')} [parameters.transitionMode="right"] - The transition mode for the sweep. * @returns {Solid} A new `Solid` object representing the swept result. */ sweepMultiple({ profiles, rail, transitionMode }: { profiles: Wire[]; rail?: Wire; transitionMode?: ("transformed" | "right" | "round"); }): Solid; /** * Offsets the wire by a specified distance. * @param {Object} parameters - Offset parameters. * @param {number} parameters.distance - The offset distance. * @param {('arc'|'tangent'|'intersection')} [parameters.joinType="tangent"] - The join type for the offset. * @returns {Face} A new `Wire` object representing the offset wire. */ offset({ distance, joinType }: { distance: number; joinType?: ("arc" | "tangent" | "intersection"); }): Face; /** * Computes the hash code for the wire. * @returns {number} The hash code. * @private */ private hashCode; #private; }