Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

I've got a simple drawing in Illustrator consisting of multiple rectangles. I will need to handle that in code later one and saved the document as SVG.

The rectangles come out as <rect /> nodes in SVG format. Is there a clean way to convert the rectangles from primitive types to a path in Illustrator ? If so, how ?

So far my hacky solution was to use Object > Path > Simplify and because I was dealing with simple boxes with no transformations applied I've also ticked the Straight Lines. This worked well for boxes (kept the same number of vertices and look)

Is there a cleaner/less hacky way to convert a primitive to a path in Illustrator ?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

The trick is to turn the path in to a Compound Path (CMD + 8). That makes the SVG output an actual path rather than a primitive type.

share|improve this answer
    
just tested: much much simpler than my approach :) Thank's for the tip, quite handy! Sometimes I need to load designs in Processing and make them interactive. If elements are SVG paths, then I can easily check if the mouse coordinates lie inside them. –  George Profenza Mar 21 at 13:10

Found anther method: Editing the primitive's anchor points. I've tried several things and looked at the generated code and it looks like simply moving an anchor point a wee bit back and forth does the trick (and also doesn't mess up the look of the shape)

share|improve this answer
    
I tried that, moving them around and back again, but as long as the resulting shape was a rectangle, it exported rectangles. The Compound Path trick, above, worked perfectly. –  Matthew Frederick Sep 2 at 22:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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