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

    From .obj to .dxf

    Scheduled Pinned Locked Moved General Discussions
    5 Posts 2 Posters 1.0k 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.
    • Gorka ArakisG Offline
      Gorka Arakis
      last edited by

      Hi there

      I´m trying to convert an obj file to dxf. Exporting stl would be fine too. Trying it this way:

      var objDeSerializer = require('@jscad/obj-deserializer');
      var stlDeSerializer = require('@jscad/stl-deserializer');
      var dxfSerializer = require('@jscad/dxf-serializer');
      const fs = require('fs');

      fs.readFile('sceneOBJ.obj', 'utf-8' , (err, data) => {
      var deserializedObj = objDeSerializer.deserialize(data, data, {output: 'geometry'});
      var dxfStringArray = dxfSerializer.serialize(deserializedObj);
      console.log(dxfStringArray);
      });

      I get this error: only JSCAD geometries can be serialized to DXF

      The obj or stl files I´m using seem to be correct (blender shows them correctly).
      Any clues??

      Thx!!

      z3devZ 1 Reply Last reply Reply Quote 0
      • z3devZ Offline
        z3dev @Gorka Arakis
        last edited by z3dev

        @Gorka-Arakis welcome

        Sorry but the documentation for the deserializer / serializer functions are not part of the documentation yet.

        You can find the documentation inside the ‘index.js’ file.

        The general rule is… options are always first. And options have a default value as well. So, the calls become…

        const geometries = deserializer({output: ‘geometry’}, rawdatafromfile)
        const blobdata = serialize({}, geometries)
        
        1 Reply Last reply Reply Quote 0
        • Gorka ArakisG Offline
          Gorka Arakis
          last edited by

          It works! Thanks!!

          z3devZ 1 Reply Last reply Reply Quote 0
          • z3devZ Offline
            z3dev @Gorka Arakis
            last edited by

            @Gorka-Arakis Yeah! And there’s more to come!

            Gorka ArakisG 1 Reply Last reply Reply Quote 0
            • Gorka ArakisG Offline
              Gorka Arakis @z3dev
              last edited by

              @z3dev Happy to hear it!

              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