Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

PackPlay/pson

Repository files navigation

pson

Small library for parsing pson

PSON Schema Specification v1.0

Introduction

PSON is a JSON schema that describes a dieline and folding method.

Glossary

  • 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)

Data Structure

Top-level structure

  • 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 or styleId should be attached to PSON to tell us more about source CAD file.
  • panels (optional) - Array of Panel objects. Each Panel generally contains all the Point 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>"]
}

Basic Class

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.

Entity

Every classes must be derived from Entity class.

  • id - any unique number or string that represent this entity
  • className - represent name of this entity's class. For example, if the entity is instantiated from Point class then its class name should be Point.
{
    "id": "unique-id",
    "className": "ClassName"
}

Point (Entity)

{
    "x": 10.0,
    "y": 10.0
}

Line (Entity)

{
    "a": "<Point>", 
    "b": "<Point>"
}

Arc (Entity)

{
    "radius": 10.0,
    "center": "<Point>",
    "a": "<Point>",
    "b": "<Point>"
}

Collection Class

Graph (Entity)

{
    "data": "<Point>",
    "children": ["{...Graph}"]
}

Panel (Entity)

{
    "outer": ["<Point>"],
    "inner": ["<Polyline|Line|Arc>"],
    "metadata": {}
}

About

Small library for parsing pson

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published