sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    .skp -> JSON -> .skp

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 5 Posters 3.0k Views 5 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.
    • M Offline
      MartinRinehart
      last edited by

      I want to write a .skp -> JSON Ruby, and then, of course, JSON -> .skp.

      Possible? How much of .skp is accessible? What will I be losing?

      Second, has anyone explored the various ways of building the .skp? How does adding four edges compare to adding a face, given four corners?

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        You want to take all entities apart into JSON values?

        What comes to mind is faces with holes need special attention. Arcs, Curves.

        Dimensions are a problem - as there is no Ruby access. As well as 3d polylines.

        DC's and their attribute dictionary? Or even any attribute dictionary. V-Ray for Sketchup for instance adds it's data in binary format.

        Textures - Projected property of textures aren't accessible.

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • C Offline
          cjthompson
          last edited by

          you should definitely add the faces by points instead of by edges, because edges are entities, so if you export to a model that doesn't already have those entities, you will get an error.

          I haven't worked with JSON at all, so I don't know how much help I can be.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            A .skp is binary file. I'm not sure I understand the question. Do you mean you want to export a model's geometry as a JSON string?

            Hi

            1 Reply Last reply Reply Quote 0
            • M Offline
              MartinRinehart
              last edited by

              @jim said:

              Do you mean you want to export a model's geometry as a JSON string?

              Exactly. The model is an object. Each collection is an array of objects. Each object in a collection has a type and an appropriate set of values, and so on.

              { entities:[{type:edge, ends:[{type:point3d, start:[r1,g1,b1], ... }], ... }] }

              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

              1 Reply Last reply Reply Quote 0
              • tbdT Offline
                tbd
                last edited by

                worked some time ago on a model2xml and it worked pretty well by extending each class with a to_xml so it was quickly implemented.

                this can be implemented in the same manner but as thomthom it is not possible to have a 100% dump and then reimport it back to SketchUp and have the same model 😞

                SketchUp Ruby Consultant | Podium 1.x developer
                http://plugins.ro

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement