SVGnest icon indicating copy to clipboard operation
SVGnest copied to clipboard

Great if it could keep groups together

Open mirzu opened this issue 9 years ago • 8 comments

I make a lot of jewelry and this would be hugely useful if it kept groups of objects together.

mirzu avatar Feb 16 '16 17:02 mirzu

hey mirzu

do you mean svg tags or physical clusters of objects? I don't have any background in jewelry, so it's not obvious to me how this might work.

Jack000 avatar Feb 22 '16 12:02 Jack000

SVG tags. Right now the parser takes them apart and places the polygons individually. If it kept the groups together and only placed the outermost group it would work perfectly for me.

mirzu avatar Feb 22 '16 14:02 mirzu

hmm.. so you would like certain parts to keep their relative positions, as if they were a single object? I'm just not quite sure how this would be useful in the context of jewelry making.

Jack000 avatar Feb 22 '16 14:02 Jack000

Here is an example file that I tried to name the different parts so this would make sense. https://www.dropbox.com/s/r52u5j6w7t1tv4t/slinky-vector.svg?dl=0

The groups with id "keep_together" and keep_together_copy" are what I would love SVG Nest to keep together. They contain shapes that will be cut and etched to make each piece of jewelery.

How it looks when cut: evernote_basic

How it looks in the drawing program, black is etched, red is cut. slinky-vector-minimal_idraw

mirzu avatar Feb 22 '16 15:02 mirzu

ah I see. In this particular case it should work as-is.

The paths that are used for nesting are the paths that are not contained by other paths. If a path is contained inside another path, it will be grouped with the outer path. So in the given example all the paths would be grouped with the outer red path.

if you have a collection of paths without a path to enclose them, you could create the enclosing path by hand or use offset+boolean operations.

it is possible to make a feature to do this as well, but like the other suggestions so far it's do-able but not exactly trivial to implement.

Jack000 avatar Feb 22 '16 15:02 Jack000

It would also be helpful if a compound path could be kept together. (That's an Illustrator term for a path node with a single d attribute defining the full shape including separate pieces.)

Keavon avatar Mar 06 '17 09:03 Keavon

I would have liked for groups to be kept together as well, even if only uncontained paths are considered: that's not how I expected it to work, and I can imagine it being useful in a few cases.

Take the following svg for instance, svgnest is stuck on "placement in progress"

expand svg code, as I cannot attach it as a file

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="125.84876mm"
   height="103.44331mm"
   viewBox="0 0 125.84876 103.44331"
   version="1.1"
   id="svg2351"
   inkscape:version="0.92.4 5da689c313, 2019-01-14"
   sodipodi:docname="example-svgnest.svg">
  <defs
     id="defs2345">
    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath445-5">
      <path
         d="M 0,0 H 595.276 V 841.89 H 0 Z"
         id="path443-4"
         inkscape:connector-curvature="0" />
    </clipPath>
    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath309-4">
      <path
         d="M 0,0 H 595.276 V 841.89 H 0 Z"
         id="path307-31"
         inkscape:connector-curvature="0" />
    </clipPath>
    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath429-7">
      <path
         d="M 0,0 H 595.276 V 841.89 H 0 Z"
         id="path427-4"
         inkscape:connector-curvature="0" />
    </clipPath>
    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath405-4">
      <path
         d="M 0,0 H 595.276 V 841.89 H 0 Z"
         id="path403-3"
         inkscape:connector-curvature="0" />
    </clipPath>
    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath377-0">
      <path
         d="M 0,0 H 595.276 V 841.89 H 0 Z"
         id="path375-7"
         inkscape:connector-curvature="0" />
    </clipPath>
    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath353-8">
      <path
         d="M 0,0 H 595.276 V 841.89 H 0 Z"
         id="path351-6"
         inkscape:connector-curvature="0" />
    </clipPath>
    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath337-8">
      <path
         d="M 0,0 H 595.276 V 841.89 H 0 Z"
         id="path335-8"
         inkscape:connector-curvature="0" />
    </clipPath>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="1.979899"
     inkscape:cx="209.61513"
     inkscape:cy="250.27199"
     inkscape:document-units="mm"
     inkscape:current-layer="g18282-3"
     showgrid="false"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:window-width="1920"
     inkscape:window-height="1080"
     inkscape:window-x="1080"
     inkscape:window-y="0"
     inkscape:window-maximized="1" />
  <metadata
     id="metadata2348">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Calque 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(15.569209,-49.736306)">
    <rect
       style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ff0000;stroke-width:0.01;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
       id="rect18284"
       width="72.563683"
       height="103.43331"
       x="-15.564209"
       y="49.741306"
       ry="0" />
    <g
       transform="translate(-0.44762797,-37.804808)"
       id="g18282-3">
      <g
         id="g18929">
        <path
           inkscape:connector-curvature="0"
           id="path457-8-5"
           style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           d="m 101.22198,122.78452 h 2.2352 c 0.008,0.23954 0.012,0.39793 0.012,0.47484 0,1.58291 -0.28998,2.77248 -0.86889,3.56764 -0.6798,0.92675 -1.83797,1.38994 -3.474858,1.38994 -2.347736,0 -3.753203,-0.83784 -4.2164,-2.51354 -0.169686,-0.62547 -0.262467,-1.59843 -0.277989,-2.91888 0,-0.25471 -0.0078,-1.28552 -0.02328,-3.0928 0.01552,-2.10009 0.03528,-3.38596 0.05821,-3.85692 0.02328,-0.7105 0.0829,-1.25483 0.179564,-1.63336 0.09666,-0.37818 0.26423,-0.74507 0.503766,-1.10032 0.748948,-1.10419 1.988256,-1.65629 3.718278,-1.65629 1.799169,0 3.073049,0.62548 3.822349,1.87643 0.36266,0.6103 0.5521,1.61784 0.56727,3.0233 v 0.0579 h -2.2352 c -0.008,-0.97296 -0.0928,-1.64501 -0.25471,-2.01542 -0.34748,-0.75671 -0.96555,-1.13524 -1.853495,-1.13524 -0.687211,0 -1.23578,0.20461 -1.64465,0.61383 -0.309033,0.30904 -0.48648,0.76835 -0.532694,1.37831 -0.05433,0.77999 -0.08149,1.95403 -0.08149,3.52142 0,1.97662 0.0194,3.62162 0.05821,4.93431 0.02328,0.84172 0.127,1.42875 0.312561,1.76071 0.363009,0.63288 0.988484,0.94968 1.876425,0.94968 0.87242,0 1.471083,-0.32033 1.795643,-0.96132 0.19261,-0.37818 0.30092,-1.26647 0.3242,-2.66418" />
        <path
           style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ff0000;stroke-width:0.01;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.94117647"
           d="m 71.370204,105.17708 h 29.616736 c 5.14533,0 9.28761,4.14227 9.28761,9.28761 v 9.773 c 0,5.14534 -4.14228,9.28761 -9.28761,9.28761 H 71.370204 c -5.145339,0 -9.287616,-4.14227 -9.287616,-9.28761 v -9.773 c 0,-5.14534 4.142277,-9.28761 9.287616,-9.28761 z"
           id="rect1160-1-2"
           inkscape:connector-curvature="0" />
        <path
           d="m 69.70309,109.86592 1.444572,3.82888 2.14395,-1.85802 z m -1.118682,-0.39131 0.894289,-0.77502 7.27493,3.90473 -0.82009,0.71072 -1.827325,-1.03541 -2.628193,2.27769 0.765112,1.95596 -0.831806,0.72087 z"
           style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:none;fill-opacity:1;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           id="path18918"
           inkscape:connector-curvature="0" />
        <path
           d="m 73.380384,126.0411 v 3.93456 h 4.334069 q 2.180412,0 3.223799,-0.48193 1.056764,-0.48912 1.056764,-1.48895 0,-1.00701 -1.056764,-1.48175 -1.043387,-0.48193 -3.223799,-0.48193 z m 0,-4.41648 v 3.23683 h 3.999651 q 1.97976,0 2.942886,-0.39561 0.976503,-0.40281 0.976503,-1.2228 0,-0.8128 -0.976503,-1.21561 -0.963126,-0.40281 -2.942886,-0.40281 z m -2.702105,-1.19404 h 6.902406 q 3.090032,0 4.762127,0.69053 1.672095,0.69053 1.672095,1.96368 0,0.98544 -0.856113,1.56807 -0.856113,0.58263 -2.51483,0.72649 1.993137,0.23017 3.090031,0.96386 1.110271,0.72649 1.110271,1.81981 0,1.4386 -1.81924,2.22264 -1.819238,0.78403 -5.176804,0.78403 h -7.169943 z"
           style="font-style:normal;font-weight:normal;font-size:20.0890522px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:none;fill-opacity:1;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           id="path18912"
           inkscape:connector-curvature="0" />
        <path
           d="m 87.802325,107.499 1.106547,1.21024 -2.848619,2.60455 6.518851,1.4096 1.424269,1.55774 -7.201226,-1.56669 0.751477,8.04682 -1.457136,-1.59368 -0.681802,-7.26353 -3.24589,2.96778 -1.106548,-1.21024 z"
           style="font-style:normal;font-weight:normal;font-size:14.43200302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:none;fill-opacity:1;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           id="path18915"
           inkscape:connector-curvature="0" />
      </g>
      <g
         id="g18941"
         transform="translate(0,37.041668)">
        <path
           d="m 101.22198,122.78452 h 2.2352 c 0.008,0.23954 0.012,0.39793 0.012,0.47484 0,1.58291 -0.28998,2.77248 -0.86889,3.56764 -0.6798,0.92675 -1.83797,1.38994 -3.474858,1.38994 -2.347736,0 -3.753203,-0.83784 -4.2164,-2.51354 -0.169686,-0.62547 -0.262467,-1.59843 -0.277989,-2.91888 0,-0.25471 -0.0078,-1.28552 -0.02328,-3.0928 0.01552,-2.10009 0.03528,-3.38596 0.05821,-3.85692 0.02328,-0.7105 0.0829,-1.25483 0.179564,-1.63336 0.09666,-0.37818 0.26423,-0.74507 0.503766,-1.10032 0.748948,-1.10419 1.988256,-1.65629 3.718278,-1.65629 1.799169,0 3.073049,0.62548 3.822349,1.87643 0.36266,0.6103 0.5521,1.61784 0.56727,3.0233 v 0.0579 h -2.2352 c -0.008,-0.97296 -0.0928,-1.64501 -0.25471,-2.01542 -0.34748,-0.75671 -0.96555,-1.13524 -1.853495,-1.13524 -0.687211,0 -1.23578,0.20461 -1.64465,0.61383 -0.309033,0.30904 -0.48648,0.76835 -0.532694,1.37831 -0.05433,0.77999 -0.08149,1.95403 -0.08149,3.52142 0,1.97662 0.0194,3.62162 0.05821,4.93431 0.02328,0.84172 0.127,1.42875 0.312561,1.76071 0.363009,0.63288 0.988484,0.94968 1.876425,0.94968 0.87242,0 1.471083,-0.32033 1.795643,-0.96132 0.19261,-0.37818 0.30092,-1.26647 0.3242,-2.66418"
           style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           id="path18931"
           inkscape:connector-curvature="0" />
        <path
           inkscape:connector-curvature="0"
           id="path18933"
           d="m 71.370204,105.17708 h 29.616736 c 5.14533,0 9.28761,4.14227 9.28761,9.28761 v 9.773 c 0,5.14534 -4.14228,9.28761 -9.28761,9.28761 H 71.370204 c -5.145339,0 -9.287616,-4.14227 -9.287616,-9.28761 v -9.773 c 0,-5.14534 4.142277,-9.28761 9.287616,-9.28761 z"
           style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ff0000;stroke-width:0.01;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.94117647" />
        <path
           inkscape:connector-curvature="0"
           id="path18935"
           style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:none;fill-opacity:1;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           d="m 69.70309,109.86592 1.444572,3.82888 2.14395,-1.85802 z m -1.118682,-0.39131 0.894289,-0.77502 7.27493,3.90473 -0.82009,0.71072 -1.827325,-1.03541 -2.628193,2.27769 0.765112,1.95596 -0.831806,0.72087 z" />
        <path
           inkscape:connector-curvature="0"
           id="path18937"
           style="font-style:normal;font-weight:normal;font-size:20.0890522px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:none;fill-opacity:1;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           d="m 73.380384,126.0411 v 3.93456 h 4.334069 q 2.180412,0 3.223799,-0.48193 1.056764,-0.48912 1.056764,-1.48895 0,-1.00701 -1.056764,-1.48175 -1.043387,-0.48193 -3.223799,-0.48193 z m 0,-4.41648 v 3.23683 h 3.999651 q 1.97976,0 2.942886,-0.39561 0.976503,-0.40281 0.976503,-1.2228 0,-0.8128 -0.976503,-1.21561 -0.963126,-0.40281 -2.942886,-0.40281 z m -2.702105,-1.19404 h 6.902406 q 3.090032,0 4.762127,0.69053 1.672095,0.69053 1.672095,1.96368 0,0.98544 -0.856113,1.56807 -0.856113,0.58263 -2.51483,0.72649 1.993137,0.23017 3.090031,0.96386 1.110271,0.72649 1.110271,1.81981 0,1.4386 -1.81924,2.22264 -1.819238,0.78403 -5.176804,0.78403 h -7.169943 z" />
        <path
           inkscape:connector-curvature="0"
           id="path18939"
           style="font-style:normal;font-weight:normal;font-size:14.43200302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:none;fill-opacity:1;stroke:#0000ff;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
           d="m 87.802325,107.499 1.106547,1.21024 -2.848619,2.60455 6.518851,1.4096 1.424269,1.55774 -7.201226,-1.56669 0.751477,8.04682 -1.457136,-1.59368 -0.681802,-7.26353 -3.24589,2.96778 -1.106548,-1.21024 z" />
      </g>
    </g>
  </g>
</svg>

Though, interestingly, the program does not complete after I get rid of the groups altogether.

MayeulC avatar Mar 26 '19 15:03 MayeulC

I make a lot of vinyl cutting and this would be hugely useful if it kept groups of objects together.

In this case, for example I need keep the words grouped for later transfer them.

lovedder1995 avatar Jul 05 '20 19:07 lovedder1995