All files / services/helpers/dxf dxf.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 8/8
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115          37x                       1x                         1x                         1x                         1x                         1x                           1x                           1x                           30x      
import * as Inputs from "../../../inputs";
import { DxfGenerator } from "./dxf-generator";
 
export class Dxf {
 
    private dxfGenerator = new DxfGenerator();
 
    /**
     * Creates a line segment definition for DXF export (pass-through for validation).
     * Example: start=[0,0], end=[10,5] → DXF line segment from origin to [10,5]
     * @param inputs Line segment definition
     * @returns Line segment DTO
     * @group dxf
     * @shortname line segment
     * @drawable false
     */
    lineSegment(inputs: Inputs.IO.DxfLineSegmentDto): Inputs.IO.DxfLineSegmentDto {
        return inputs;
    }
 
    /**
     * Creates an arc segment definition for DXF export (curved path between two points).
     * Example: center=[5,5], radius=5, startAngle=0°, endAngle=90° → quarter circle arc
     * @param inputs Arc segment definition
     * @returns Arc segment DTO
     * @group dxf
     * @shortname arc segment
     * @drawable false
     */
    arcSegment(inputs: Inputs.IO.DxfArcSegmentDto): Inputs.IO.DxfArcSegmentDto {
        return inputs;
    }
 
    /**
     * Creates a circle segment definition for DXF export (closed circular path).
     * Example: center=[10,10], radius=5 → full circle with diameter 10 centered at [10,10]
     * @param inputs Circle segment definition
     * @returns Circle segment DTO
     * @group dxf
     * @shortname circle segment
     * @drawable false
     */
    circleSegment(inputs: Inputs.IO.DxfCircleSegmentDto): Inputs.IO.DxfCircleSegmentDto {
        return inputs;
    }
 
    /**
     * Creates a polyline segment definition for DXF export (connected line segments through points).
     * Example: points=[[0,0], [5,0], [5,5], [0,5]] → rectangular polyline path
     * @param inputs Polyline segment definition
     * @returns Polyline segment DTO
     * @group dxf
     * @shortname polyline segment
     * @drawable false
     */
    polylineSegment(inputs: Inputs.IO.DxfPolylineSegmentDto): Inputs.IO.DxfPolylineSegmentDto {
        return inputs;
    }
 
    /**
     * Creates a spline segment definition for DXF export (smooth curve through control points).
     * Example: controlPoints=[[0,0], [5,10], [10,0]] → smooth curved path through points
     * @param inputs Spline segment definition
     * @returns Spline segment DTO
     * @group dxf
     * @shortname spline segment
     * @drawable false
     */
    splineSegment(inputs: Inputs.IO.DxfSplineSegmentDto): Inputs.IO.DxfSplineSegmentDto {
        return inputs;
    }
 
    /**
     * Creates a path from multiple segments (combines lines, arcs, circles, polylines, splines).
     * Similar to OCCT wires - segments are connected to form a continuous or multi-part path.
     * Example: segments=[lineSegment, arcSegment, polylineSegment] → combined path entity
     * @param inputs Path definition with segments
     * @returns Path DTO
     * @group dxf
     * @shortname path
     * @drawable false
     */
    path(inputs: Inputs.IO.DxfPathDto): Inputs.IO.DxfPathDto {
        return inputs;
    }
 
    /**
     * Creates a paths part with layer and color assignment for DXF organization.
     * Groups multiple paths into a single layer with consistent styling.
     * Example: paths=[path1, path2], layer="Outlines", color=red → grouped geometry
     * @param inputs Paths part definition
     * @returns Paths part DTO
     * @group dxf
     * @shortname paths part
     * @drawable false
     */
    pathsPart(inputs: Inputs.IO.DxfPathsPartDto): Inputs.IO.DxfPathsPartDto {
        return inputs;
    }
 
    /**
     * Generates a complete DXF file from paths parts (exports 2D CAD drawing format).
     * Supports lines, arcs, circles, polylines, and splines organized in layered paths.
     * Example: model with 3 parts on different layers → valid DXF file string for CAD software
     * @param inputs DXF model definition
     * @returns DXF file content as string
     * @group dxf
     * @shortname dxf create
     * @drawable false
     */
    dxfCreate(inputs: Inputs.IO.DxfModelDto): string {
        return this.dxfGenerator.generateDxf(inputs);
    }
 
}