6

Is there a way to force an SVG to force paths to be a polygon primitive? Paths currently have an issue rendering in the software I need them, and since I don't need any features a path would afford me I'd like them all to be polygons.
I am aware illustrator does this by default, but once a line has a curve in it it is marked as a path and will never be exported as a polygon despite not having any curves, and being a closed contiguous shape. I would like a way to

The path in question below only uses a single M and multiple Line To(L)/Horizontal Line To(H) in its pathdata, so there are no bezier curves to justify it being a path.

M439.83,367.33l52.33-1l3.5-32.67h346.21l10.38,74.58h22.25l3.5-12.38h42.25l-4.88,22.88h33.13v3.13h13.25l17.33,79.96l-2.83,12.42h-9.33l21.25,107.67h7.58l14.67,72l-3.75,10.75H892.21l0.25,3.25l-2.33,10.54H461.08l-1.67-11.63l10.5-108.58h-57.25l-2.08-11.75l14.58-107.17H418l-2.33-12.83l6.75-44.08h10.33L439.83,367.33z

https://betravis.github.io/shape-tools/path-to-polygon/ is a solution but I'd like something I can do automate or at the very least do locally for quality of life reasons.

Converting the points to corners with the direct selection tool will NOT work, the line will still be exported as a path.

  • I can not replicate your issue. If i make a part curved and then reset all corners back to hard it again with the anchor points tool exports a polygon. Also have you tried simplify path with straight lines option. – joojaa Dec 16 '16 at 14:29
1

I tried some SVG capable apps and found out that opening and exporting your path in Sketch does indeed convert the path to a polygon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.