import { BitbybitOcctModule, TopoDS_Compound, TopoDS_Shape } from "../../bitbybit-dev-occt/bitbybit-dev-occt"; import { OccHelper } from "../occ-helper"; import * as Inputs from "../api/inputs"; /** * Importing SVG drawings as OpenCascade shapes. The importer parses the document (paths, basic * shapes, transforms and the style cascade), reduces every element to the generic path vocabulary * of `path` and builds wires, and faces where it can, laid on the ground plane and placed by the * import options. `loadSVG` gives one compound for the whole drawing; `loadSVGStructured` gives one * shape per element with its fill and stroke. */ export declare class OCCTSVG { private readonly och; private readonly builder; private readonly faceBuilder; constructor(occ: BitbybitOcctModule, och: OccHelper); /** Resolve the public face strategy + an element's own fill into a concrete rule (or none → wires). */ private resolveRule; /** Pull the individual wires out of a built element (a single wire or a compound of wires). */ private extractWires; /** Convert the internal normalized subpath to the public path vocabulary. */ private toPathSubpath; private styleToMeta; /** * Lay every shape flat on the ground plane and place the whole drawing as one unit. The SVG is * built in the XY plane, rotated onto the XZ ground plane (matching the other on-ground * primitives), then its combined bounding box is anchored according to `alignment` and finally * oriented to `direction` and moved to `center`. */ private placeAll; /** Parse, build and place every drawable SVG element; shared by both public entry points. */ private buildAndPlace; /** * Parses an SVG document and builds every drawable element into one compound shape on the * ground plane, ready to draw, extrude or transform as a whole. * * `faceStrategy` decides whether closed outlines become faces, `scale` and `flipY` map SVG * units and its downward Y axis, and `alignment`, `direction` and `center` place the result. * Invisible elements are skipped unless asked for. * @param inputs - The SVG text and the import and placement options * @returns One compound holding every element * @group io * @shortname load svg * @drawable true * @example * ```typescript * const drawing = await bitbybit.occt.svg.loadSVG({ * svg: svgText, * faceStrategy: Bit.Inputs.OCCT.svgFaceStrategyEnum.auto, * makeRibbons: false, * includeInvisible: false, * joinSegments: true, * tolerance: 1e-7, * scale: 0.1, * flipY: true, * alignment: Bit.Inputs.Base.basicAlignmentEnum.midMid, * direction: [0, 1, 0], * center: [0, 0, 0], * }); * ``` */ loadSVG(inputs: Inputs.OCCT.LoadSVGDto): TopoDS_Compound; /** * Parses an SVG document and builds one shape per drawable element, each bundled with its * resolved fill, stroke and stroke width, plus the parse warnings and the SVG view box. * * Use it when the elements need their own colors or separate handling; `loadSVG` gives the * whole drawing as one shape. Faces are built where the outline allows it. * @param inputs - The SVG text and the import and placement options * @returns The shapes with their styles, the warnings and the view box * @group io * @shortname load svg structured * @drawable false * @example * ```typescript * const options = new Bit.Inputs.OCCT.LoadSVGDto(); * options.svg = svgText; * options.scale = 0.1; * const result = await bitbybit.occt.svg.loadSVGStructured(options); * result.shapes.forEach(s => console.log(s.fill, s.stroke)); * ``` */ loadSVGStructured(inputs: Inputs.OCCT.LoadSVGDto): Inputs.OCCT.SVGResult; }