PHP to JSON #634
-
|
Hi! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
Hello, the final drawing is made up of paths. Here's the json from the rectangle example: {
"models": {
"example": {
"paths": {
"ShapeLine1": {
"type": "line",
"origin": [
0,
0
],
"end": [
50,
0
]
},
"ShapeLine2": {
"type": "line",
"origin": [
50,
0
],
"end": [
50,
100
]
},
"ShapeLine3": {
"type": "line",
"origin": [
50,
100
],
"end": [
0,
100
]
},
"ShapeLine4": {
"type": "line",
"origin": [
0,
100
],
"end": [
0,
0
]
}
}
}
},
"origin": [
0,
0
]
}So your model object will need to generate the |
Beta Was this translation helpful? Give feedback.
-
|
Please add the creation of objects directly from json, otherwise it is impossible to create shapes without node.js |
Beta Was this translation helpful? Give feedback.

You can use maker.js on the backend, in node.js - from php you’d probably need to spawn a shell command.
Your example json:
{ "models": { "myRectangle": { "type": "rectangle", "width": 100, "height": 50, "origin": [0, 0] } } }Is not in the schema that maker.js uses. Maker.js does have concepts like Rectangle but that is code driven, and not in declarative json. When using json directly you will be working at a low level with the 3 primitives: line, circle and arc.