JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to edit the converted model

    Development Discussions
    2
    2
    322
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jess yan
      jess yan last edited by

      Hi! If I want to adjust the imported dxf model by mouse or form in jscad. what do I do? It is found that the js code converted by @jscad/dxf-deserializer is not readable code. Does this mean that the imported model cannot be adjusted with the mouse?
      @z3dev

      // Produced by JSCAD IO Library : DXF Deserializer (2.3.2)
      
      const { colors, geometries, maths, primitives, transforms } = require("@jscad/modeling");
      const { colorize, hexToRgb } = colors;
      
      const main = () => {
        let layers = [];
        return layers.concat(layer0(),layer1(),layer2(),[])
      };
      
      function createPolygon(listofpoints, color) {
        let polygon = geometries.poly3.fromPoints(listofpoints);
        if (color) polygon.color = color;
        return polygon;
      }
      function layer0() {
        const jscad2_polygons = [
          createPolygon(
            [
              [-7.477781319009107, 0, 4.999988321182407],
              [-7.477781319009107, 0, 0],
              [-7.571599135852652, -0.0100263315710659, 0],
            ],
            null
          ),
          createPolygon(
            [
              [-7.477781319009107, 0, 4.999988321182407],
              [-7.571599135852652, -0.0100263315710659, 0],
              [-7.571599135852652, -0.0100263315710659, 4.999988321182407],
            ],
            null
          ),
          createPolygon(
            [
              [-7.571599135852652, -0.0100263315710659, 4.999988321182407],
              [-7.571599135852652, -0.0100263315710659, 0],
              [-7.845747687667226, -0.07906478610326254, 0],
            ],
            null
          ),
      ...
        ];
        let jscad2 = geometries.geom3.create(jscad2_polygons);
        return [jscad2];
      }
      function layer1() {
        return [];
      }
      function layer2() {
        return [];
      }
      module.exports = { main };
      
      
      z3dev 1 Reply Last reply Reply Quote 0
      • z3dev
        z3dev @jess yan last edited by

        @jess-yan another good question!

        there's an issue with the internal logic of the WEB UI that prevents the 'script' to be shown. it's not that easy to fix either.

        you can use the CLI (command line) application to convert the DXF file to a script.

        you can find instructions on how to use the CLI in the README file at...

        https://github.com/jscad/OpenJSCAD.org/tree/master/packages/cli

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB | Contributors