Small library for parsing pson
PSON is a JSON schema that describes a dieline and folding method.
- box - refer to all packaging box that is constructed by folding.
- dieline - a blueprint of a box
- cut - a part of dieline where cutting is made (pink)
- crease - a part of dieline where folding happens (dashed blue)
- bone - a 3D animator used in folding dieline via any arbitary 3D software. Usually refer to armature object in Blender.
- panel - a face in dieline. Usually separated by folding crease (i.e. this blueprint has 13 panels)
- cut - Array of entity reference id that are part of cut
- crease - Array of entity reference id that are part of crease
- bone - Array of entity reference id that act as 3D folding. The array will almost always consists of only 1
Graph
Entity. - entities - Array of all entities that are used in this file. Each entity can be reused by referencing its id. There are many type of entity, at which, all must be derived from
Entity
class. - metadata - Map of metadata objects. For example,
parameters
orstyleId
should be attached to PSON to tell us more about source CAD file. - panels (optional) - Array of
Panel
objects. EachPanel
generally contains all thePoint
for one box's panel.
{
"cut": ["<Entity ID>"],
"crease": ["<Entity ID>"],
"bone": ["<Entity ID>"],
"entities": ["<Entity Object>"],
"metadata": {
"styleId": "<style id>",
"parameters": {}
},
"panels": ["<Panel Object>"]
}
All classes must derived from Entity
class.
<X>
refers to using ID reference to an object of class X. (i.e. "x": "<Point>"
refers to setting x
to Point.id
of an arbitary Point
object)
{...X}
refers to spreading structure of class X.
Every classes must be derived from Entity
class.
id
- any unique number or string that represent this entityclassName
- represent name of this entity's class. For example, if the entity is instantiated fromPoint
class then its class name should bePoint
.
{
"id": "unique-id",
"className": "ClassName"
}
{
"x": 10.0,
"y": 10.0
}
{
"a": "<Point>",
"b": "<Point>"
}
{
"radius": 10.0,
"center": "<Point>",
"a": "<Point>",
"b": "<Point>"
}
{
"data": "<Point>",
"children": ["{...Graph}"]
}
{
"outer": ["<Point>"],
"inner": ["<Polyline|Line|Arc>"],
"metadata": {}
}