JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    How to edit the converted model

    Scheduled Pinned Locked Moved Development Discussions
    2 Posts 2 Posters 727 Views 1 Watching
    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 yanJ Offline
      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 };
      
      
      z3devZ 1 Reply Last reply Reply Quote 0
      • z3devZ Offline
        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

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        Powered by NodeBB | Contributors