brepjs API Reference
    Preparing search index...

    Function importSVG

    • Import all <path> elements from an SVG string as Blueprints.

      Uses regex extraction (no DOM parser dependency) to find <path d="...">. Each path becomes a separate Blueprint with its curves.

      Parameters

      • svgString: string

        Complete SVG XML string.

      Returns Result<Blueprint[]>

      A Result wrapping an array of Blueprints (one per <path> element).

      Paths that fail to parse are silently skipped. Only the successfully parsed paths appear in the result. If no paths are found at all, an error Result is returned.

      const blueprints = unwrap(importSVG(svgFileContents));
      blueprints.forEach(bp => console.log(bp.curves.length));

      importSVGPathD to import a single path d attribute directly.