Separating a shape into components[solved]

Post questions on how to use or achieve an effect in Inkscape.
Neon22
Posts: 11
Joined: Mon Mar 07, 2011 10:31 am

Separating a shape into components[solved]

Postby Neon22 » Sun Sep 15, 2013 1:36 pm

I've got a shape made from 'Trace Bitmap'. Its of a QR code.
The image shows the problem clearest.
I'm trying to extract each separate section as a shape. As you can see currently they all share points at the boundary of each block.
Image

I'm trying to find an efficient way to do it. I have a lot to create.
I was hoping I could select some vertices and copy and paste them - creating a new shape with just the selected vertices.
But Inkscape doesn't work like that.

Its a closed shape - maybe there is a simple boolean op I can do,
or maybe I have to make a huge number of copies (one for each potential shape) and paste-in-place then
select and delete all the unwanted points but that seems lengthy,
or ....

any ideas appreciated.
Last edited by Neon22 on Tue Sep 17, 2013 9:16 pm, edited 1 time in total.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Separating a shape into components

Postby druban » Sun Sep 15, 2013 5:18 pm

I know this is not going to be a lot of help to you but I am a little busy so I can't give all the steps necessary to do this; I am hoping that you will be able to run with this brief summary and figure out the details:
What you need to do is to set up a tiled clones grid made of squares the right size and distributed over your target: the target can be either the original bitmap or the traced complex path - and then set the clones to take their color from what is underneath them, and you will have an array of clone squares, each with the right color, and then you can unlink all the clones and you will have what you want - I think. If you have a lot to do as you said you might find it easier not to have to trace the source bitmaps.

Please note that the biggest problem you are likely to have with this is that for the color to come from the underlying the original's paint has to be set to "unset" before cloning or else- no go.
Good luck!
Your mind is what you think it is.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Separating a shape into components

Postby Lazur » Mon Sep 16, 2013 12:25 am

That method Druban described is the cleanest but maybe you don't need to redraw-recolour each QR code grid you are working with.
For separating such path at the double nodes, press Ctrl++ and Ctrl+Shift+K after and delete any unnecessary paths -but why would you need that?

How to avoid the manual work: in the current development build, there is an extension for creating QR codes
under extensions>render>barcode>QR code. Maybe you can use that and save alot of time.

Neon22
Posts: 11
Joined: Mon Mar 07, 2011 10:31 am

Re: Separating a shape into components

Postby Neon22 » Mon Sep 16, 2013 8:46 pm

Thanks guys,
I'm reading up on tiling clones and checking out the inbuilt QR code generator. (alas fails in 0.48.4 with localise error - I'll check the code)
However: ctrl++ does a uniion - but a union with what ? how will a union separate a region from the original ?
ctrl-shift-K combines one or more paths into a single shape. How do I use this for this task.

LazurURH When you say "Why would you need that ?" I think I'm missing something. Can you explain further ?

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Separating a shape into components

Postby Lazur » Mon Sep 16, 2013 11:51 pm

The Ctrl++ equals a boolean operation -if no other object selected, then it uses the parts of the compound path and
actually rephrases the compound path to another one, without segments overlapping eachother,
thus if you use the break apart function (after the union) -Ctrl+Shift+K-, it will break apart the compound path to single ones, the ones you were looking for.
That is my experience, I don't know if the terminology is correct or have any inside knowledge of inkscape's workflow.
On a sidenote any boolean operation produces some inaccuracy, about 0,005-0,01 pixels.

I just couldn't think of what would you use each part of the QR code further on.
Thus could not see the point what would that be good for.
Like there are squares sharing the same edge in a QR code, not just corner to corner ones, so why to have some random shapes separated.
And why to edit them manually anyway if there is an extension that can generate good ones.

Neon22
Posts: 11
Joined: Mon Mar 07, 2011 10:31 am

Re: Separating a shape into components

Postby Neon22 » Tue Sep 17, 2013 9:16 pm

Ohh that is just brilliant. I did not realise that at all.
so if I duplicate the object and then union it with itself - it all breaks apart.
I still can't quite work out why Union does that but its a great result.

As for why - I'm creating the QR code at many different Z depth levels in many different pieces so you can only see it when lined up looking at it along the normal axis - else its just a jumble of shapes from any other angle.
its for an art piece - you can only se ethe qr code form one viewpoint.
So I needed the blocks broken out of it.

Cheers...

oh yeah - I still think it would be useful to be able to copy and paste a selected set of nodes and therby make a new shape containing only those nodes.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Separating a shape into components[solved]

Postby Lazur » Tue Sep 17, 2013 10:15 pm

I see.

Neon22 wrote:...so if I duplicate the object and then union it with itself...

That can mean you add the duplicant to the original -which may work too, but it possibly results in many unnecessary nodes.
Selecting only one path is the best for that.

Neon22 wrote:...As for why - I'm creating the QR code at many different Z depth levels in many different pieces so you can only see it when lined up looking at it along the normal axis - else its just a jumble of shapes from any other angle.
its for an art piece - you can only se ethe qr code form one viewpoint...


So you will have to scale each shape with different z depth up a bit?
If that viewpoint is too close to the front shape, and the end shape is far behind it, the needed scaling can be large.

Making the shapes from parallel faces -probably blender to design it would be more effective.
Also you can duplicate vertices in edit mode too there, and, more importantly it remembers the selection if switched to object mode.

Using random models painted in right colours from a viewpoint -you can do that easily with a projector, without the need of separating the code,
by projecting the QR code from the right viewpoint.
Like this:
Image

Another thought: humans cannot read QR codes, only some devices can -which are probably held by the hands by the viewers.
That means two different viewpoints, with about 50 cm difference in z depth.
Which may limit the view angle you can use, and determine the scale and distance of the shapes.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Separating a shape into components[solved]

Postby tylerdurden » Tue Sep 17, 2013 10:36 pm

Having each bit a separate path could be helpful if importing into 3D cad that has direct editing (push-pull on faces).

This qr was made in brass rule by a master letterpress printer:
Image
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Neon22
Posts: 11
Joined: Mon Mar 07, 2011 10:31 am

Re: Separating a shape into components[solved]

Postby Neon22 » Wed Sep 18, 2013 9:34 pm

exactly right.
I use exported svg as import to Wings3D - based on the greatest modeler in the world: Symbolics - S-Geometry... (long gone lisp machine)


Return to “Help with using Inkscape”