UNPKG

@bitbybit-dev/base

Version:

Bit By Bit Developers Base CAD Library to Program Geometry

173 lines (172 loc) 5.43 kB
/* eslint-disable @typescript-eslint/no-namespace */ export var IO; (function (IO) { /** * Line segment defined by start and end points */ class DxfLineSegmentDto { constructor(start, end) { if (start !== undefined) { this.start = start; } if (end !== undefined) { this.end = end; } } } IO.DxfLineSegmentDto = DxfLineSegmentDto; /** * Arc segment defined by center, radius, and start/end angles in degrees */ class DxfArcSegmentDto { constructor(center, radius, startAngle, endAngle) { if (center !== undefined) { this.center = center; } if (radius !== undefined) { this.radius = radius; } if (startAngle !== undefined) { this.startAngle = startAngle; } if (endAngle !== undefined) { this.endAngle = endAngle; } } } IO.DxfArcSegmentDto = DxfArcSegmentDto; /** * Circle defined by center and radius */ class DxfCircleSegmentDto { constructor(center, radius) { if (center !== undefined) { this.center = center; } if (radius !== undefined) { this.radius = radius; } } } IO.DxfCircleSegmentDto = DxfCircleSegmentDto; /** * Polyline segment defined by multiple points * Can include bulge values to create arc segments between vertices */ class DxfPolylineSegmentDto { constructor(points, closed, bulges) { /** * Whether the polyline is closed * @default false */ this.closed = false; if (points !== undefined) { this.points = points; } if (closed !== undefined) { this.closed = closed; } if (bulges !== undefined) { this.bulges = bulges; } } } IO.DxfPolylineSegmentDto = DxfPolylineSegmentDto; /** * Spline/B-spline segment defined by control points and degree */ class DxfSplineSegmentDto { constructor(controlPoints, degree, closed) { /** * Degree of the spline (typically 2 or 3) * @default 3 */ this.degree = 3; /** * Whether the spline is closed * @default false */ this.closed = false; if (controlPoints !== undefined) { this.controlPoints = controlPoints; } if (degree !== undefined) { this.degree = degree; } if (closed !== undefined) { this.closed = closed; } } } IO.DxfSplineSegmentDto = DxfSplineSegmentDto; /** * A path can contain multiple segments of different types (lines, arcs, polylines, circles, splines) * Similar to OCCT wires that can combine different edge types */ class DxfPathDto { constructor(segments) { if (segments !== undefined) { this.segments = segments; } } } IO.DxfPathDto = DxfPathDto; /** * A part containing multiple paths on the same layer with the same color */ class DxfPathsPartDto { constructor(layer, color, paths) { /** * Layer name for all paths in this part * @default Default */ this.layer = "Default"; /** * Color for all paths in this part * @default #000000 */ this.color = "#000000"; if (layer !== undefined) { this.layer = layer; } if (color !== undefined) { this.color = color; } if (paths !== undefined) { this.paths = paths; } } } IO.DxfPathsPartDto = DxfPathsPartDto; /** * Main DXF model containing all path parts */ class DxfModelDto { constructor(dxfPathsParts, colorFormat, acadVersion) { /** * Color format to use in the DXF file * - "aci": AutoCAD Color Index (1-255) - Better compatibility with older CAD software like Design CAD 3D Max * - "truecolor": 24-bit RGB true color - Full color spectrum, requires newer CAD software * @default aci */ this.colorFormat = "aci"; /** * AutoCAD version format for DXF file * - "AC1009": AutoCAD R12/R11 - Maximum compatibility with older CAD software (e.g., Design CAD 3D Max) * - "AC1015": AutoCAD 2000 - Modern format with extended features * @default AC1009 */ this.acadVersion = "AC1009"; if (dxfPathsParts !== undefined) { this.dxfPathsParts = dxfPathsParts; } if (colorFormat !== undefined) { this.colorFormat = colorFormat; } if (acadVersion !== undefined) { this.acadVersion = acadVersion; } } } IO.DxfModelDto = DxfModelDto; })(IO || (IO = {}));