xsrf / easyeda-svg-import

Simple SVG Importer for EasyEDA PCB that doesn't convert everything to Comic Sans 😄
85 stars 8 forks source link

Use 'pointArr' of solid region for tracks with curves #9

Closed xsrf closed 3 years ago

xsrf commented 3 years ago

Just found out that EasyEDA populates the attribute pointArr of a solid region, created by an SVG string, with points that approximate the path. This could also be used for #4 instead of paper.js by creating a temporary solid region... 🤔

xsrf commented 3 years ago

The API used for that is accessible via

api('editorCall', { 
    cmd: 'pathToPolygons', 
    args: ['M 4632 3103.5 Q 4642 3113.5 4652 3103.5 Q 4662 3093.5 4652 3123.5 Q 4642 3153.5 4632 3123.5 L 4632 3103.5']
});
xsrf commented 3 years ago

âš  pathToPolygons only supports Arcs with same x/y radius!

xsrf commented 3 years ago

Going to keep paper.js for now, since it is needed for flattening ellipses (arc with different x/y radius)