.skp -> JSON -> .skp
-
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?
-
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.
-
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.
-
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?
-
@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], ... }], ... }] }
-
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

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 LoginAdvertisement