Inkscape Community

Help Using Inkscape => Inkscape Beginners' Questions => Topic started by: pghosh on April 07, 2017, 04:21:42 AM

Title: Problem using path operation
Post by: pghosh on April 07, 2017, 04:21:42 AM
Dear Members,
I wish you all a very good day and thank you all for developing this powerful software. I am a geologist and use InkScape for teaching my PhD students.

I am using this forum for the first time and hope starting a new topic is the right thing to do.

I am trying to remove the overlap between two adjacent straight-edged polygons. I used the path operation: "Difference". It trimmed one polygon but in the process I lost the other object that was used as the cutting edge. So next time I copied it before the operation and used "Paste in place" to get it back.

Is there any simpler way of achieving the same?

Also note that I could not use the erase tool (with zero width) for the same task as it draws a freeform and thus drawing straight edges and snapping to vertices is probably not possible.

Please teach me.

With regards

Parthasarathi Ghosh
Title: Re: Problem using path operation
Post by: brynn on April 07, 2017, 09:47:01 AM
Welcome to the forum!

I would suggest not using the Eraser tool.  It works for some people, but for others like me, it doesn't always work.  And plus, there are other ways to handle removing content, using vector tools (which arguably might be more appropriate).

Yes indeed, for most if not all of the path operations, the top object is more or less "consumed" by the operation.  In my workflow, I usually start by duplicating the object that's on top.  Duplicating is different from copy/paste but sort of like paste in place.  It creates the duplicate, which is right on top of the original.  So I just select it, and the bottom object, and perform the operation.  Then the original is already still there, so you don't have to paste it.
Title: Re: Problem using path operation
Post by: Moini on April 08, 2017, 12:30:11 PM
For duplicating an object in place, you can also just use Ctrl+D.
Title: Re: Problem using path operation
Post by: pghosh on April 11, 2017, 01:43:38 AM
Thank you Brynn & Moini for helpful suggestions. Yes it makes the task easier.

Is it possible to write a small script providing an option for automating preservation of the path operator object and also to provide a options for which object should be used as cutting edge in a manner similar to that provided in the Align and Distribute panel.

I am planning to learn how to make programmatic changes to InkScape. Maybe one day I'll be able to make a small code contribution.

I have another comment regarding the path averaging algorithm. For that should I start a new thread?

With regards

Partha
Title: Re: Problem using path operation
Post by: brynn on April 11, 2017, 04:47:47 AM
I don't know how to write scripts, but I would guess you could write one to preserve the top object.  (Or really the script would probably have to do what we did "manually", which is duplicate the top object first.  Because I think it's hard coded....and maybe not even just hard coded, but maybe can't be done any other way.  I'm not sure what gives me that idea, but I have the impression that the top object must be sacrificed, by definition.) (could be wrong impression but fwiw  :wink1:)

For the 2nd part, I'm not sure I completely understand, about the object used as the "cutting edge".  It's always the object on top which provides the cutting edge, and you have to choose that.  Or even sometimes draw it.  So I'm not sure if a script could choose it for you.  And for aligning the object....it seems like a script would need a lot of input from you about how you want it aligned. 

Or do you mean that you want the script to draw the object that you need?  I guess if you could give the script enough input, it would work.

Someone who understands Inkscape, as well as scripts, a lot better than I do, can give you a better answer.

But if you're thinking of doing this with a new extension or extensions, here's some info to get you started down that road:  https://inkscape.org/en/develop/extensions/

I'm curious what is the situation on your canvas where simply duplicating the top object takes too much time.  It is that you want to do a lot of path operations at the same time (or at least very quickly)?  We already have extensions to do many path operations at once, using just one top object to "cut" all the others.  I guess it must already have some code for this?  Although it might not be in the language you wanted to use  https://inkscape.org/en/~Moini/%E2%98%85multi-bool-extension-cut-difference-division.

Your last question about "path averaging algorithm", I'm not sure.  What is that?  It sounds like the math which would be used in interpolation.  Or other LPEs or extensions? Or maybe in Union?  If it's part of a path operation, or related to one, you can ask it here.  Otherwise, I think Beyond the Basics board would be best.  It might be a question for developers, who unfortunately rarely visit forums.

You might want to check out the development mailing list and/or user mailing list, which is read and often answered by deveopers.  Or you could search the archives if  you don't want to subscribe.  https://sourceforge.net/p/inkscape/mailman/  Also you might find Launchpad interesting, which is Inkscape's bug tracker (and also where feature requests are made).  https://launchpad.net/inkscape  I'm sure it must be a treasure trove for budding developers.
Title: Re: Problem using path operation
Post by: Moini on April 11, 2017, 06:22:01 AM
The multi-bool extension keeps the topmost object (and it also works with only two objects).

Oh - hi Partha :) (the same one as in 'provides windows builds'?)
Title: Re: Problem using path operation
Post by: pghosh on April 17, 2017, 07:40:40 AM
I have a busy canvas as I have imported a large number of polygons created in a different software (CAD). That is why I do not have prior knowledge of the order in which the objects were created/imported. However, I have tried your method and found that it is actually quite easy. Thanks.

Sorry, for confusing the matter by mentioning "Align". Just for clarification: What I wanted to say is that the existing "Align & Distribute" Panel of InkScape gives a number of options to choose which object should be used as the anchor for aligning or distributing the others. That Panel is not directly related to path operations. I was just wondering if options similar to those are also available for path operation.

I thank both of you for guiding me to the relevant extension(s) and especially to the Launchpad. I'll definitely check.

Finally, on path averaging. The tool at present allows the user to draw a number of curves and at the end calculates an average path based on all the curves drawn. The processes mimics the way someone makes a pencil sketch. I am excited to see that feature of InkScape. However, there is one issue. When I make a pencil sketch, physically, I first draw a rough curve and then keep on adding successive strokes that are more and more precise. So the last curve is most important to me. That is why I would like to know if out of N number of paths drawn, whether during the averaging operation the geometry of all the input paths are given equal weight or the Nth path is given more weight than the first one?
Title: Re: Problem using path operation
Post by: brynn on April 17, 2017, 10:04:47 AM
Oh - hi Partha :) (the same one as in 'provides windows builds'?)

I don't think so, Moini.  I could be wrong, but I think Partha may be fairly common name (Indian?).  (I only have confidence to comment, because I can see the email address and it's not the same as the other Partha.)

Finally, on path averaging. The tool at present allows the user to draw a number of curves and at the end calculates an average path based on all the curves drawn. The processes mimics the way someone makes a pencil sketch. I am excited to see that feature of InkScape.

This is an Inkscape tool?  Oh, you  mean the Sketch LPE?  Well no, that draws the multiple lines and creates a sketch effect.  Is it an extension, or maybe filter?  Oh, it must be something in the development version!?

Definitely you need to ask developers about that!  The mailing list would probably be better, because this sounds like something new, which only a few developers may know about.  If you posted on IRC, it would be a matter of luck whether the developers who know about this will be logged on when you post.  So that's why I would lean toward the mailing list.
Title: Re: Problem using path operation
Post by: Moini on April 17, 2017, 04:06:18 PM
Don't know about the implementation, but I'd guess that the sketch mode of the pencil tool weighs all paths equally (http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-Creating.html).
Title: Re: Problem using path operation
Post by: brynn on April 19, 2017, 08:09:56 AM
Aaah yes.  The Pencil tool has a  Sketch Mode, and that's what it does - averages the sketch strokes.  Still would need help from developers about that.

Actually I should say that's what it says it does, since  I've never figured out how to use sketch mode.  I'm not very good at sketching, but still would be interesting to try it.  It doesn't seem to be mentioned in the manual (http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-Creating.html#Paths-Pencil)  I wonder if it only works with a tablet?
Title: Re: Problem using path operation
Post by: Moini on April 20, 2017, 01:12:57 PM
Copied from the linked manual page:

Quote
Holding down the Alt key while drawing enables the Sketch mode. While in this mode, all strokes are averaged to create a final stroke, temporarily shown as a red path. Releasing the Alt key finalizes the path. This feature is considered experimental and does not give the expected result if one strokes a line back and forth. Instead, draw all your strokes in the same direction.
Title: Re: Problem using path operation
Post by: brynn on April 20, 2017, 02:01:45 PM
Oh geez!  Good thing it wasn't a snake, lol.

So it does work with a mouse.  But it looks like it really is better suited for use with a tablet.
Title: Re: Problem using path operation
Post by: pghosh on April 21, 2017, 06:13:01 AM
Hi Moini, I am a different "Partha". Yes the name Partha is common in eastern India. Actually my full name is quite long - it is Parthasarathi. But, sure, you can call me Partha if you like.

Thanks for the inputs on the path problems. I'll take your suggestions and use the mailing list to contact the developers.

Bye

Partha
Title: Re: Problem using path operation
Post by: pghosh on April 21, 2017, 06:53:42 AM
Yes. Launchpad seems to be the right place for me.
I suppose that I need to open a new Ubuntu One account.

Thanks

Partha
Title: Re: Problem using path operation
Post by: Moini on April 21, 2017, 08:12:01 AM
Yes, unfortunately that long way via creation of UbuntuOne is required :-/, Parthasarathi (wish I knew how to pronounce!)

Not sure if it may be useful for you, but if you need a specific z-order, then the 'Restack' extension may be interesting - it is able to change the z-order of objects depending upon their location on the canvas, or previous z-order. Extensions -> Arrange -> Restack
Title: Re: Problem using path operation
Post by: pghosh on April 24, 2017, 12:58:07 AM
Hi,
I tried to send an email to 'inkscape-devel@lists.sourceforge.net'

However, I received the following, possibly, automated response: "You are not allowed to post to this mailing list, and your message has been automatically rejected.  If you think that your messages are being rejected in error, contact the mailing list owner at inkscape-devel-owner@lists.sourceforge.net".

What makes me eligible for sending emails to "devel" mailing list?

Good day

Partha
Title: Re: Problem using path operation
Post by: brynn on April 24, 2017, 03:52:06 AM
You have to subscribe to the list.  Somewhere up above I (or someone) gave you a link to where you can subscribe.

You don't have to set up an account and receive all the mail from the list.  You can still read replies from the archives (I think I gave you links to that too).  But you have to subscribe to the list to be able to post a message.
Title: Re: Problem using path operation
Post by: pghosh on April 27, 2017, 12:42:26 AM
Okay. Thank you.

Partha