nicklockwood / ShapeScript

The ShapeScript 3D modeling app for macOS and iOS
https://shapescript.info
MIT License
395 stars 18 forks source link

SVG paths don't support A (arc) command #6

Closed armadsen closed 2 years ago

armadsen commented 2 years ago

I'm using this SVG path:

M435,390.39a10,10,0,0,1,7.46,3.82l49.73,63.57a9.09,9.09,0,0,1,.11,11.31l-49.84,63.72a8.29,8.29,0,0,1-7.46,3.58H153.15a9.2,9.2,0,0,1-7.15-3.62L96.27,469.2a9.09,9.09,0,0,1-.11-11.31L146,394.18c1.42-1.81,3.37-3.79,5.48-3.79H435m0-3H151.16c-2.57.13-5,1.74-7.52,4.93L93.8,456a12,12,0,0,0,.13,15l49.71,63.55a12.21,12.21,0,0,0,9.51,4.77H435a11.19,11.19,0,0,0,9.82-4.74l49.84-63.71a12,12,0,0,0-.13-15l-49.71-63.55a13.06,13.06,0,0,0-9.82-5Z

ShapeScript fails with Unexpected token 'a'.

I notice that 'a' isn't implemented in SVGPath.processCommand().

nicklockwood commented 2 years ago

Thanks for reporting. It's probably not trivial to add this as Euclid.Path doesn't currently support arcs either, but I'll look into it.

armadsen commented 2 years ago

Yeah, and even at the CGPath level, you'd have to figure out the arc yourself, as there's no built in support for adding elliptical (not circular) arcs to a CGPath.

FWIW, that path is pretty simple (see below) and came straight out of Adobe Illustrator. It's just my first attempt to use the feature.

Screen Shot 2021-12-06 at 12 45 18 PM
nicklockwood commented 2 years ago

@armadsen this is now fixed.