gotcha

Author Topic: How to duplicate a linked offset and relink it automatically  (Read 3039 times)

October 23, 2017, 02:01:47 AM
Read 3039 times

negora

  • Sr. Newbie

  • Offline
  • **

  • 7
Hello:

This is the first time that I write in this forum, so hello everybody ;).

Nowadays, I use LibreOffice Draw to make my diagrams. I'm happy with it, but I'm trying to use Inkscape for the same, because I want to reuse my knowledge about Inkscape and, also, because I love this application.

Something that I like from Draw is that, when I resize a node, the text in it wraps automatically (if you configure it that way). I've been able to achieve the same in Inkscape, using linked offsets and text that flows into a frame. I've found the solution in the question "Border around formatted text in Inkscape" in StackExchange. I'm happy with the result.

However, I would like to put some nodes out of the page, and use them as quick templates. That way, I only would need to duplicate each node when I needed it, and edit the duplicated one. The problem is that the duplicated offset isn't relinked to the duplicated reference. So I've to open the XML editor and relink it by hand, which makes me lose precious time.

Is there a way to duplicate and relink an offset automatically?

Thank you.
  • 0.92.1
  • Debian 9.2

October 23, 2017, 04:00:39 AM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

I'm not sure if I completely understand.  When I follow the steps, the duplicated group does have the linked offset still linked and the text is still linked and flowed into frame.  I'm using 0.92.2 on Windows.

Here's SVG file to show.  Maybe there's something I don't understand?

(Note that you can't see the flowed text in the forum display, because flowed text isn't part of SVG standards (so browsers don't support it).  So you'll have to open the SVG file in Inkscape, to investigate.)

flow-linked-text.svg
*flow-linked-text.svg
(13.82 kB . 901x472)
(viewed 774 times)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

October 23, 2017, 05:14:55 AM
Reply #2

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I think there's an option in the preferences somewhere, to relink clones when being copied, maybe that will work here, too?

Negora, for Inkscape, the term 'node' is already 'in use', as it's the specific word for the nodes that make up the paths. (I know you mean XML nodes, but can you please rather use the term 'object' or 'path' - that will make it a lot easier for people to understand you).

October 23, 2017, 09:10:23 AM
Reply #3

negora

  • Sr. Newbie

  • Offline
  • **

  • 7
Welcome to the forum!

Thank you ;) .

I'm not sure if I completely understand.  When I follow the steps, the duplicated group does have the linked offset still linked and the text is still linked and flowed into frame.  I'm using 0.92.2 on Windows.

Your example shows just what I mean. But I would like that the duplicated offset were re-linked to the duplicated shape automatically, instead of keeping the link to the original one.

Just to clarify, I've attached one example from me to this message. I've left, out of the drawing, the text that flows into the frame. To simplify the example.  Indeed, I should have done that from the beginning to avoid confusion. But I thought that, if I described the whole picture (that I want to draw a diagram), there might be a better solution for my problem.

Anyway, the solution from Moini seems to work. But thanks to you too.

I think there's an option in the preferences somewhere, to relink clones when being copied, maybe that will work here, too?

You're right :) . The option is a checkbox located here:

Code: [Select]
Edit -> Preferences... -> Behaviour -> Clones -> Duplicating original+clones/linked offset -> Relink duplicated clones

I've tested my example after marking that checkbox, and it has worked flawless. Thank you!

Negora, for Inkscape, the term 'node' is already 'in use', as it's the specific word for the nodes that make up the paths. (I know you mean XML nodes, but can you please rather use the term 'object' or 'path' - that will make it a lot easier for people to understand you).

I've to admit that, since the first time that I've written it, the term "node" hasn't sounded well to me :P . I wanted to mean a node in the terms of a graph or a diagram (these are composed by nodes and edges). But I haven't realized that this word has another meaning in terms of vectorial graphics. I'll be more careful the next time. Thanks for the advice.
  • 0.92.1
  • Debian 9.2

October 23, 2017, 02:00:39 PM
Reply #4

negora

  • Sr. Newbie

  • Offline
  • **

  • 7
In the end, the flowed text has resulted to be important for my problem. I've just cloned the whole group of elements (shape + linked offset + flowed text), and I've realized that, although the offset is relinked automatically, the flowed text isn't. So I've had to link it to the duplicated offset by hand.

But this is a minor issue compared to the link between the shape and the offset. Why? Because for the later, I had to calculate by hand, again, the distance between the shape and the offset. But in the case of the flowed text, I only need to select the text and the offset, and press ALT + W.

Would you consider this a bug? I mean: the fact that the flowed text isn't relinked, even although I've marked the option in Preferences.

Thank you!
  • 0.92.1
  • Debian 9.2

October 23, 2017, 05:00:09 PM
Reply #5

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Food for possible workarounds, depending on what you're intending to do with your drawing:
Is it necessary for the text to stay editable? Is it necessary for the text to be flowed text?
If you clone a group, you can always later exchange elements within the group.

As for the cloning/bug question:
So, do I understand correctly that your structure is:

Group >
 Shape >
  Dynamic/Linked (?) Offset of Shape >
    Text flowed into frame using Offset as frame

?

(rather unusual setup, I think - but that's one more reason why there may be bugs)

And if you clone this, what is the issue you see?

October 24, 2017, 06:35:17 PM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Your example shows just what I mean. But I would like that the duplicated offset were re-linked to the duplicated shape automatically, instead of keeping the link to the original one.

Just to clarify, I've attached one example from me to this message. I've left, out of the drawing, the text that flows into the frame. To simplify the example.  Indeed, I should have done that from the beginning to avoid confusion. But I thought that, if I described the whole picture (that I want to draw a diagram), there might be a better solution for my problem.

Ok, so I wasn't understanding the problem.  I thought the text was the main issue - that you needed the text to adjust automatically to changes to its "frame" (linked offset).  And that the "frame" changes when you edit the original "frame".  Since the status bar was identifying it as linked, I assumed it was linked to its own duplicated original path.

Good catch on that option, Moini!  Now that you mention it, I think I remember that it is a relatively new option (in the last few new versions).  I'm not sure if that option had been considered a bug or a feature request.  Oh gosh, it's a new option for 0.92.2 (Important Bug Fixes section, includes link to the old bug report)!

For this re-linking behavior, I wonder why developers "attached" the re-link behavior to clones, and not duplicates?  Shouldn't it behave the same for both?

Ok, I think I see what you mean.  When I try the re-link path option for clones, I find that the text is still linked to the original.  The linked offset path is correctly linked to its duplicated original.  But the text is not.

Would you consider this a bug? I mean: the fact that the flowed text isn't relinked, even although I've marked the option in Preferences
I guess it depends on your perspective whether re-linking the text would be a bug or feature request.  Oh look!  Already reported:  https://bugs.launchpad.net/inkscape/+bug/1433130

According to that, copy/paste behaves as expected!

I'm not sure why the stackexchange technique uses the linked offset path.  I guess it maintains sort of a margin around the text.  I wonder if there's any other way to have the text adjust itself, when the frame is changed?  I guess the text would adjust itself when flowed into just a regular path, right?.

So if the clones option doesn't work out for some reason, you could avoid the linked offset by just using a regular path.    Unless it's doing something else that I don't recognize?  And also, it sounds like you could use Copy/Paste, to keep the text linked properly? 

I think I might ask some of my questions on the mailing list - like why clones and not duplicates
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

October 25, 2017, 12:49:53 AM
Reply #7

negora

  • Sr. Newbie

  • Offline
  • **

  • 7
Food for possible workarounds, depending on what you're intending to do with your drawing:
Is it necessary for the text to stay editable? Is it necessary for the text to be flowed text?
If you clone a group, you can always later exchange elements within the group.

Yes, I need that the original shape and the flowed text are editable. I want to use the group (shape + offset + text) as a template that I can duplicate "n" times and edit as needed. Because I may need shapes with different sizes, depending on the text that they contain. I want to form a diagram with all them.

The fact of using a linked offset is to have a margin between the shape border and the text. That way I can mimic the behaviour of programs like LibreOffice Draw, that allow to insert shapes and edit their inner texts.

By the way, right now I only need to push ALT + W to re-link the flowed text to the duplicated offset. But if I could avoid this step too... It would be great ;) .

As for the cloning/bug question:
So, do I understand correctly that your structure is:

Group >
 Shape >
  Dynamic/Linked (?) Offset of Shape >
    Text flowed into frame using Offset as frame

?

(rather unusual setup, I think - but that's one more reason why there may be bugs)

And if you clone this, what is the issue you see?

Exactly. Your layout is right.

The problem is this: The duplicated linked offset is relinked to the duplicated shape (which is right), but the duplicated flowed text IS NOT relinked to the duplicated offset (which is wrong). It's still linked to the original offset.

I guess I've complicated my explanation too much, ha, ha, ha.

Oh gosh, it's a new option for 0.92.2

I'm using 0.92.1, from the Debian repositories. That bug report seems to say that it's fixed in 0.92.2 (backported from 0.93). However, you're using 0.92.2 and are also experiencing the same bug, Right? So, Isn't it fixed in 0.92.2?

So if the clones option doesn't work out for some reason, you could avoid the linked offset by just using a regular path.    Unless it's doing something else that I don't recognize?  And also, it sounds like you could use Copy/Paste, to keep the text linked properly?

Good point. But I need an offset to be able to resize the original shape and that the flowed text wraps automatically, without having to edit its dimensions by hand.

I think I might ask some of my questions on the mailing list - like why clones and not duplicates

I'm sorry, but I don't understand what you mean here. The re-linking seems to work only with duplicates and not with clones. That's the expected behaviour in my opinion. Because duplicates are copies that are expected to be modified after the fact. But clones can't be altered directly, so the re-linking has no sense.

If, instead of that, you're referring to the fact that the option is located in the "Clones" section and not in a new one called "Duplicates", I agree with you. I guess that it's in "Clones" because, at the beginning, they only considered the possibility of re-linking duplications of clones. But the truth is that it affects to any element that has the notion of "linking". For example:

  • Clones
  • Linked offsets
  • Flowed text

Whenever you duplicate one of these types of items, together with the shapes that they're linked to, you've to decide either if they've to be linked to the original shapes or the duplicated ones.

So I would put this option in "Behaviour -> Duplications". I also got surprised of its location. Maybe we could open a bug report to suggest this?
  • 0.92.1
  • Debian 9.2

October 25, 2017, 01:10:36 AM
Reply #8

negora

  • Sr. Newbie

  • Offline
  • **

  • 7
Just to clarify, here it's a sketch. The red arrows mean the linkage between elements.

I've just tested 0.92.2, using the Flatpak for Linux, and the bug still persists :/ .
  • 0.92.1
  • Debian 9.2

October 25, 2017, 04:41:02 AM
Reply #9

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Thank you, negora. Yes, to me that is a bug.

Can you do a quick search in the reports over at launchpad:
https://bugs.launchpad.net/inkscape to see if this one has already been reported, and create one (please including your last picture and an example svg file that will make it easy to reproduce) if there isn't one yet (or if you can't find it)?

As for the inner margin aka padding, people were thinking about it already: http://tavmjong.free.fr/blog/?p=938 (Tav is a member of the W3C SVG working group - but SVG2 is somehow in an unclear state at the moment - at least to me) and https://www.w3.org/TR/SVG2/text.html#TextShapePadding

The good news is that that 'shape-padding' property works totally fine in Inkscape 0.92.2 and in the development version:

Bildschirmfoto_2017-10-25_13-36-25.png
*Bildschirmfoto_2017-10-25_13-36-25.png
(126.62 kB . 1067x666)
(viewed 668 times)


(doesn't look right in Firefox or Chrome, but does export correctly to pdf - so depends on where you want to use it)

October 25, 2017, 05:17:09 PM
Reply #10

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
I'm using 0.92.1, from the Debian repositories. That bug report seems to say that it's fixed in 0.92.2 (backported from 0.93). However, you're using 0.92.2 and are also experiencing the same bug, Right? So, Isn't it fixed in 0.92.2

The bug that was fixed is that when linked offsets are cloned, the offsets are re-linked to the cloned original path (not the original or parent path).  So that's what you want, partly anyway.

The bug that still seems to be happening, is when we duplicate.  That's the question I want to ask the mailing list - why was this only fixed for clones and not duplicates.  It seems to me like duplicates should also be re-linked.

And plus, the text on path doesn't get linked to either the cloned or duplicated path.  It remains linked to the parent or original path, either way.

Can you do a quick search in the reports over at launchpad:
https://bugs.launchpad.net/inkscape to see if this one has already been reported, and create one (please including your last picture and an example svg file that will make it easy to reproduce) if there isn't one yet (or if you can't find it)?

The bug I found yesterday, about linked text on path, wasn't the right one?  https://bugs.launchpad.net/inkscape/+bug/1433130

Moini, if you're saying both of these (re-link duplicate offsets, and relink both cloned and duplicated text on path) sound like a legitimate bugs, then I'll bypass asking on the mailing list.  I just do that, to avoid posting a lot of unnecessary reports (because I often don't understand existing reports, or can't find them).

negora, if you don't want to become involved with bug reports, I'll be glad to post it.  But otherwise, please feel free :)

The good news is that that 'shape-padding' property works totally fine in Inkscape 0.92.2 and in the development version:

Wow, that would eliminate the need for the linked offset, for that stackexchange technique!  Moini, can that only be done in the XML Editor?  There's no canvas or gui option?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

October 26, 2017, 12:23:18 AM
Reply #11

negora

  • Sr. Newbie

  • Offline
  • **

  • 7
Thank you, negora. Yes, to me that is a bug.

Can you do a quick search in the reports over at launchpad:
https://bugs.launchpad.net/inkscape to see if this one has already been reported, and create one (please including your last picture and an example svg file that will make it easy to reproduce) if there isn't one yet (or if you can't find it)?

OK. When I finish working I'll do that and I'll inform you both about the report that I publish (if one doesn't exist yet).

As for the inner margin aka padding, people were thinking about it already: http://tavmjong.free.fr/blog/?p=938 (Tav is a member of the W3C SVG working group - but SVG2 is somehow in an unclear state at the moment - at least to me) and https://www.w3.org/TR/SVG2/text.html#TextShapePadding

The good news is that that 'shape-padding' property works totally fine in Inkscape 0.92.2 and in the development version:

Great. I'll take a look at that feature and see how can I apply this to my diagram. Thank you!

The bug that was fixed is that when linked offsets are cloned, the offsets are re-linked to the cloned original path (not the original or parent path).  So that's what you want, partly anyway.

The bug that still seems to be happening, is when we duplicate.  That's the question I want to ask the mailing list - why was this only fixed for clones and not duplicates.  It seems to me like duplicates should also be re-linked.

My apologies. I didn't understand you. Now it's clearer to me and I agree with your conclusion ;) .

negora, if you don't want to become involved with bug reports, I'll be glad to post it.  But otherwise, please feel free :)

Yes, post it, please ;) . Although I'm used to fill bug reports (I'm a programmer), you know better than me about Inkscape and other errors similar to this one. I wouldn't be able to include as much information as you would do, of course. Thank you!

If you need that I test something in Debian, let me know.
  • 0.92.1
  • Debian 9.2

October 26, 2017, 03:07:54 PM
Reply #12

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
@brynn: yes, there is no GUI for that atm. (but as negora was already using the xml editor, that part is probably not an issue for him/her).

October 27, 2017, 07:19:14 AM
Reply #13

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Thanks Moini.  I was just asking for myself.

Yes, post it, please ;) Although I'm used to fill bug reports (I'm a programmer), you know better than me about Inkscape and other errors similar to this one. I wouldn't be able to include as much information as you would do, of course. Thank you!

Well, I'm not so sure if I do know more than you (a programmer, which I am not).

Hhm, the bug tracker's automatic search (which oddly finds different results than a regular search) has found this one.  I think it's the same request we have, isn't it?  https://bugs.launchpad.net/inkscape/+bug/239297  Some of the discussion is a bit technical, which I can't really follow.

I've just added a new comment to the end of that one.  But if that's not the same bug, or more info needs to be added, please let me know.   (Or just add your own comments.)

And for the issue with the flowed text, since that bug I found yesterday sounds like the same thing to me, I've added a comment to that one as well.  And again, let me know if it needs more details, or if it doesn't sound like the same bug.  https://bugs.launchpad.net/inkscape/+bug/1433130
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

October 30, 2017, 01:38:47 AM
Reply #14

negora

  • Sr. Newbie

  • Offline
  • **

  • 7
In my opinion, the second report is more appropriate for the last problem that we've described here, since it's specific of flowed text. But I don't think that informing about the other problem in the first report does any harm. Just the opposite. So thank you for doing it too ;) .

I hadn't realized about the workaround described in the second report, by the way: using Copy & Paste instead of Duplicate avoids the problem entirely. I've tried it and the relinking works fine :) . I've voted for this report too, to increase its priority.

I guess that, internally, Inkscape does something different when it copies and pastes, from what it does when it duplicates. The results look similar, but only with the former, the <svg:use> element of <svg:flowRegion> is relinked correctly.

Off topic: One day I've to learn about Inkscape seriously. I feel that I'm missing a lot of features. I didn't know what LPEs were, ha ha ha. I've tested the "Grid" effect, and it had been very useful for some tasks in the past.
  • 0.92.1
  • Debian 9.2

October 30, 2017, 02:55:55 PM
Reply #15

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
There's a great tutorial series on Inkscape in the Full circle magazine, that goes into the depths of all the little hidden gems (and also tells you about the worms...): http://www.inkscapeforum.com/viewtopic.php?f=6&t=11981
(and if you happen to live in Germany, you're welcome to visit one of my workshops :) )