9
$\begingroup$

I have generated the laser cut of a jigsaw in Inkscape.

After importing the svg in Blender I am now trying to extract each jigsaw piece into it's own object.

The problem is that my SVG is made of multiple overlapping bezier curves and I cannot I use "separate" > "loose" to extract the pieces

I have tried Boolean modifier on a plane but it doesn't seem to work with a flat opened loop ( even if I extrude it)

When I extract the pieces, I would like to control their name (like r1c1, r1c2 ... ) to identify their original position.

intersecting bezier curves

$\endgroup$
  • $\begingroup$ Can you upload your .blend file to Blend Exchange? $\endgroup$ – Shady Puck Aug 1 '16 at 20:24
  • $\begingroup$ I've edited the question $\endgroup$ – DaftWooly Aug 1 '16 at 20:47
13
$\begingroup$

Knife project curves

The main problem with your object is that the pieces are not defined by a boundary. The curves are not intersecting each other: they are just drawn lines, and expecially in the "crossroads", there is't a common point between them.

enter image description here

In order to get the intersection, I would suggest to take advantage of the Knife project tool to a plane object (Shift+A Add mesh: Plane) of the right size. It has some degree of approximation but should be good enough for the provided example. Remember to keep the whole mesh inside the 3D view and run the command in ortho top view as it is view dipendent.

You don't need to convert your objects to meshes or join them: just select them all and run the command in edit mode (it might take a but of time to complete).

enter image description here

Finish by:

  • calling the Edges Split operator (you can find it in the Crtl+E menu) in order to disjoin the faces
  • and then finally run the Separate by Loose parts (P) command on the remaining faces.
$\endgroup$
  • 3
    $\begingroup$ Note : this technique allows to keep the curves' control points clean and I could drop the resolution of the curve before converting to mesh. $\endgroup$ – DaftWooly Aug 2 '16 at 11:10
  • $\begingroup$ Nice method. It's also possible to separate pieces after cutting with Ctrl+E > Edge Split (a bit faster). $\endgroup$ – Mr Zak Aug 2 '16 at 19:08
  • $\begingroup$ Tremendously faster @MrZak! I'll write that in the answer, that's the right way to do that. $\endgroup$ – Carlo Aug 2 '16 at 19:21
4
$\begingroup$

You will never be able to do this inside Blender, at least not without some serious loss of quality and information, you'll have to do it in Inkscape, and even then it wont be easy.

Not only are Blender's Bezier curve tools not refined or full featured enough to deal with this, Boolean operations won't work on bezier curves nor on open non manifold objects.

Quick and dirty method

In Inkscape use the bucket fill tool and fill in the spaces to automatically create the jigsaw pieces.

Re-import only the new curves as SVG into Blender

Pros: It is very quick and easy

Cons: This is a geometric approximation method, the precision is zoom dependent and leaves a lot to be desired. It will always lead to serious loss of quality as shown bellow. Zoom in for better precision but it will never match precisely.

enter image description here

Slow but precise

Join the end nodes of all paths on pairs so they can become filled in such a way that you end up with the whole jigsaw puzzel filled with all possible strips

enter image description here

Make copies off all strips (you will need several of each for multiple operations) and start combining them with Boolean operations like Subtraction Ctrl + - or Intersection Ctrl + * so that you end up with all combinations and hence all pieces.

Combine

In the end break them all apart with Shift + Ctrl + K and reimport into Blender as SVG.

Separate Blender Jigsaw pieces

$\endgroup$
  • $\begingroup$ This technique is certainly a lot more troublesome and involved to work with, but it will give you the most accurate results, without any loss on information. You pieces will remain clean editable bezier curves without converting to mesh with thousands of points $\endgroup$ – Duarte Farrajota Ramos Aug 2 '16 at 11:55
0
$\begingroup$

While I'm leaving carlo's answer as the valid one, over 200 pieces, knife project is seriously slow on my laptop. That said, it seems to be the only way to do it within Blender, and it produces acceptable pieces with 64 vertices ( at 4 in the curves' ures) and it's easily scriptable.

For over 200 pieces, Inkscape seems to be more suitable, the method that I found (http://tuts.ahninniah.graphics/how-to-make-a-jigsaw-puzzle-with-gimp-and-inkscape/) works well with the extension I use to generate these curves in the first place (https://github.com/Neon22/inkscape-jigsaw)

The only drawbacks is that it adds more control points and you end up with around 110 verts per shape.

Method :

Generate the curves using the extension.

Make sure the svg curves are not grouped by pressing Shift+Ctrl+G several times

Group all the curves but not the border : Select all Ctrl+A, Shift+clic on the border shape and combine Path > Combine (Ctrl+K)

Make sure that the grouped curves object is on top : Object > Raise to Top (Home)

Select the two objects Ctrl+A and go to Path > Division (Ctrl+/)

You can then import it in blender

To answer the second part of my question ( correct naming of the shapes ) I made a python script that changes the name of the shape based on its position :

for obj in bpy.data.objects:
    row = math.floor(obj.location.y/size)
    col = math.floor(obj.location.x/size)
    obj.name = "shape-{}-{}".format(row,col)
    obj.data.name = obj.name

note : I had also tried X_ALL https://github.com/zeffii/mesh_tiny_cad to connect the curves but it was way to slow and a bit unreliable. So I didn't pursue it further.

conclusion : I still prefer carlo's way, and I will try to use it to generate the complex jigsaws on a powerful computer. But ideally I would like a script capable of merging/connecting intersecting edges on 100,000+ edges.

$\endgroup$

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.