# Stiles IMOS iX export format

The IMOS iX input format is an XML format that contains information about a single item with all attributes that specify the item, its position and orientation, as well as data about the order and the customer. The attributes of the element are stored in a key-value format contained in an element with the following format:

attributes   := keyValuePair ( '|' keyValuePair )*
keyValuePair := <key> ':=' <value>

The export of the core creates a JSON object that contains an array with the position, orientation, size and attributes of the individual elements of a configuration to be exported.

# Export JSON format specification

IMOSiXExport : {
    "articles": [ 
        Article* 
    ],
}
Article : {
    "position": [<x>, <y>, <z>],
    "rotation": [<x>, <y>, <z>],
    "size": [<width>, <depth>, <height>],
    "attributes" : <string>
}
property description
position The position of the article relative to the items in the configuration
rotation The orientation of the article; Euler angles in Radians
size The size of the article
attributes The attributes of the article in the IMOS iX key/value pairs format

# Example

Component definition with IMOS iX export definition:

{
    "id": "component1",
    "parameters": [
        { "key": "width", "type": "Decimal", "defaultValue": "1000" },
        { "key": "depth", "type": "Decimal", "defaultValue": "1000" },
        { "key": "height", "type": "Decimal", "defaultValue": "1000" }
    ],
    "geometry": "
        AddCube({width, depth, height}, {1000, 1000}, 0, {0, 1000}, 20);
            SetObjSurface(roomle_script_test:yellow);
    ",
    "parentDockings": {
        "points": [
            {
                "mask": "mask1",
                "position": "{width, depth/2, height/2}",
                "rotation": "{0, 0, 0}"
            }
        ]
    },
    "childDockings": {
        "points": [
            {
                "mask": "mask1",
                "position": "{0, depth/2, height/2}",
                "rotation": "{0, 0, 90}"
            }
        ]
    },
    "possibleChildren": [
        { "componentId": "component1" }
    ],
    "plugin-data": {
        "imos-ix-export": {
            "isRoot": true
        }
    }
}

Configuration:

{
    "componentId": "component1",
    "children": [
        {
            "componentId": "component1",
            "dockParent": "[{1000, 500, 500}]",
            "dockChild": "{0, 500, 500}"
        }
    ]
}

Resulting export JSON:

{
    "articles": [
        {
            "position": [-750.0, 0.0, -250.0],
            "rotation": [0.0, 0.0, 0.0],
            "size": [1000.0, 1000.0, 1000.0],
            "attributes": "depth:=1000.00|height:=1000.00|width:=1000.00"
        },
        {
            "position": [-250.0, 0.0, 250.0],
            "rotation": [0.0, -1.5708, -0.0],
            "size": [1000.0, 1000.0, 1000.0],
            "attributes": "depth:=1000.00|height:=1000.00|width:=1000.00"
        }
    ]
}