JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. dburt
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    dburt

    @dburt

    0
    Reputation
    2
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    dburt Unfollow Follow

    Latest posts made by dburt

    • Newbie question: Write 2D drawing to SVG file?

      Hello and thank you for creating and maintaining this very impressive library!
      I'm trying to use V2 for a simple project and am currently stuck on what I'm sure is a very elementary issue.

      I'd like to save an array of rectangles to an SVG file. Originally was hoping to save as PNG, but not sure if this is currently supported?

      Referring to the example on the @jscad/openjscad npm page, is it possible to do something like this:

      const jscad = require("@jscad/openJscad");
      const { rectangle } = require("@jscad/modeling").primitives;
      const fs = require("fs");
      
      const input = rectangle({ center: [0, 0], size: [10, 20] });
      
      const outputData = jscad.generateOutput("svg", input);
      
      fs.writeFileSync("panels.svg", outputData.asBuffer());
      

      Running this code, I get these errors:

      TypeError: cag._toCSGWall is not a function
      at Array.map (<anonymous>)
      at CAG.union
      at convertToSolid2
      at prepareOutput
      at Object.generateOutput
      

      Any tips or guidance on how to accomplish this would be greatly appreciated.

      Thank you in advance!

      posted in General Discussions
      D
      dburt