Hi all,
assuming i have a list of all component names and their (center) X/Y position in mil from the PCB origin as well as their origins.
Now I want to programmatically position all components in the PCB layout at the given positions w/ their rotation.
(as if I trained a monkey selecting manually a component by its name and enter the X/Y values)
So i have a bunch of hurdles and questions, I hope some can be answered by you :)
I tried fetching the source using api('getSource', {type: "json"});
-> result: got all important information. but... every single drawable entity with their subentities and texts and arcs and stuff etc has its absolute position in there.
I would have to fully understand the mechanics of what is a LINE and an ARC and TEXT and PAD and must not forget a single unexpected item there.
[Bug?] Tried to get the real position like in the examples using api('coordConvert', {type:'canvas2real',x: 10})
-> result: i was not able to convert "mil" or "mm" units into the "real" coordinates, as the API call is crashing:
message: "getPCBUnit is not defined"
stack: "coordConvert@[https://easyeda.com/editor/6.4.7/js/main.min.js:18:19407](https://easyeda.com/editor/6.4.7/js/main.min.js:18:19407%5Cna/)
**edit:** Oh no! Most of the post vanished. It was cut right in the middle of the stackdump. darn.
Questions:
1\. how to set the rotation \*absolute\* ?
2\. how to get the current X/Y/rotation?
3\. how to select a component by its name \(like "R12"\)?
4\. what would be your preferred approach to set component positions?
Thats my current test code:
`api('moveObjsTo', { objs:["gge5d7d37af6db8001c"], x:4000, y:3000}); // manually set position to origin`
`api('rotation', {ids:["gge5d7d37af6db8001c"], degree:90});`
Firefox
70.0
Windows
10
EasyEDA
6.4.7