Skip to main content
Participant
July 12, 2020
Question

Force SVG Export using all <rect>

  • July 12, 2020
  • 1 reply
  • 667 views

I'm trying to create an svg map of a storage unit facility using all rectangles, but when I export to svg, the resulting file contains some polygons <polygon> and rectangles <rect>.  All of the layers in Illustrator are rectangles, so I'm trying to understand why only some are being exported at <polygon> tags.  I need them to be <rect> tags for down stream processing.  Is there any way to force Illustrator to save them as <rect> tags?  Here's a snippet of the svg file:

 

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 495.38 438.92">
  <defs>
    <style>
      .cls-1 {
        fill: #01cdcd;
      }
    </style>
  </defs>
  <g id="B038">
    <g>
      <polygon class="cls-1" points="347.78 97.03 356.94 89.9 371.21 108.14 362.1 115.24 347.78 97.03"/>
      <path d="M363.92,101.94,378.14,120l-9,7.08L354.92,109l9-7.08m0-.14-9.16,7.2,14.34,18.26,9.17-7.2L363.94,101.8Z" transform="translate(-7.03 -11.94)"/>
    </g>
  </g>
  <g id="B135">
    <g>
      <polygon class="cls-1" points="414.83 163.88 424.52 156.32 431.86 165.73 422.2 173.27 414.83 163.88"/>
      <path d="M431.51,168.34l7.31,9.3-9.58,7.52-7.31-9.3,9.58-7.52m0-.11-9.69,7.62,7.4,9.42,9.69-7.62-7.4-9.42Z" transform="translate(-7.03 -11.94)"/>
    </g>
  </g>
  <g id="B059">
    <g>
      <rect class="cls-1" x="175.55" y="287.49" width="24.09" height="23.67" transform="translate(-151.87 167.91) rotate(-38.16)"/>
      <path d="M189.74,282.68l14.53,18.5L185.45,316l-14.53-18.5,18.82-14.79m0-.2-19.06,15,14.71,18.73,19.06-15-14.71-18.72Z" transform="translate(-7.03 -11.94)"/>
    </g>
  </g>
  <g id="B061">
    <g>
      <rect class="cls-1" x="156.81" y="302.19" width="24.09" height="23.67" transform="translate(-164.96 159.47) rotate(-38.16)"/>
      <path d="M171,297.38l14.54,18.49L166.7,330.66l-14.53-18.49L171,297.38m0-.21-19.06,15,14.72,18.73,19-15L171,297.17Z" transform="translate(-7.03 -11.94)"/>
    </g>
  </g>
</svg>
This topic has been closed for replies.

1 reply

Mylenium
Legend
July 12, 2020

Without seeing and understanding your artwork, nobody can tell you much. AI very much has its own mind about this stuff and it all boils down to specific interactions, grouping and retaining the appearance. Chances are that you did something to the rectangles like applying transforms instead of actually resizing the parametric paths and that sort of thing.

 

Mylenium

Participant
July 12, 2020