[Solved] Adding multiple snap lines

Discuss the drawing application
Post Reply
3+4i
Posts: 11
Joined: Sun Aug 26, 2018 10:28 am
Location: Germany

[Solved] Adding multiple snap lines

Post by 3+4i »

Is there a way to add multiple snap lines other than adding them one by one? It takes five clicks (plus entering a number) to add one. I need like several dozen of them, doing it that way would be quite a pain. The result of my Google-search was quite bleak, which usually isn't a good sign :( .

Adding them via macro doesn't even seem possible at all. That would have helped as well, since the snap lines I need follow a pattern, but it's not a simple one.
Last edited by 3+4i on Sat May 11, 2019 10:13 am, edited 1 time in total.
LibreOffice 6.0.7.3 on Xubuntu 18.04
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: adding multiple snap lines

Post by Lupp »

There is a dispatcher command .uno:setSnapItem, but (as usual) I cannot find information about arguments. Called without arguments it simply opens the insertion dialog. Next problem: How access an inserted snapitem for editing.

Most likely won't pay for the needed research.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
keme
Volunteer
Posts: 3699
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Adding multiple snap lines

Post by keme »

"... not a simple [pattern]" suggests that adjusting the grid is also not an option. You could look into it anyway. Shouldn't take too long.
Menu item Tools - Options, expand branch Draw - Grid.

Did you know: You can drag snap lines out from the rulers. At worst one click saved per line, compared to using the Insert menu item. Right click for precise editing of position.
Manual precision may be sufficient, in which case you save a lot of clicks. :super:
Press the Alt key while dragging to toggle snap mode for positioning the line (smooth drag or snap to grid).

If you explain the desired snap pattern in more detail than "not simple", someone here may have suggestions for other workarounds.
3+4i
Posts: 11
Joined: Sun Aug 26, 2018 10:28 am
Location: Germany

Re: Adding multiple snap lines

Post by 3+4i »

keme wrote:"... not a simple [pattern]" suggests that adjusting the grid is also not an option.
That's exactly the reason why I wrote this. I already considered it, but I wasn't quite happy with changing a global setting for that. I really had hoped there would be an easier solution. It might still be possible with using the grid though, I'd just need to change it several times.
Did you know: You can drag snap lines out from the rulers.
I knew, but I honestly didn't even consider it. You're right though, it actually is faster indeed, I never would have guessed :o .
If you explain the desired snap pattern in more detail than "not simple", someone here may have suggestions for other workarounds.
The vertical lines are still fairly simple: I need one every 1.7 cm, but with a shift of 1 cm. I could use the margin to get the shift, then it would easily work with the grid. The interval changes somewhere in the middle of the page, since I have some wider shapes there, but I guess I could manually place snap lines there. After that, the pattern continues, just with a different shift.

For the horizontal lines I have alternating intervals, I haven't determined the precise values yet. The whole thing is a fairly large dependency tree, one of the lines is for the items, the other is for the labels in between, so I don't necessarily need both at the same time. That would reduce it to a single interval and I could use the grid again. Guess I'll try that then.
LibreOffice 6.0.7.3 on Xubuntu 18.04
User avatar
keme
Volunteer
Posts: 3699
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Adding multiple snap lines

Post by keme »

You could also add a "Guides" layer where you draw lines for your custom snap grid.
  • There is the Modify - Distribution tool to distribute lines evenly.
    Draw your first line. Copy/paste the number you need. Position the first and last line and use the distribution tool.
  • After you have all your guide lines in place, edit layer properties, tick Locked and untick Printable.
    This makes your grid visible on screen, but you can't select lines and they won't print.
  • You can shift-click the layer tab to toggle visibility.
    Snap does not depend on visibility. Will snap to invisible objects.
  • If you use this, you may also want to make a "Guiding_lines" style where you set the line color and style for your entire grid.
    This way you can easily change the line appearance of your custom snap grid, so it doesn't visually interfere with your actual content. Makes it easier to work with if you have really complex diagrams.
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Adding multiple snap lines

Post by Lupp »

The proposition by keme seems to be the optimal advice to me. It is in addition fully elaborate.

I could only tell you that I once used draw a lot without even being aware of the snapitem feature. I used invisible lines -sometimes lines so faintly coloured that they weren't printed on my printers - for the purpose. You get the advantage that as-if snapitems of this kind can be grouped.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
3+4i
Posts: 11
Joined: Sun Aug 26, 2018 10:28 am
Location: Germany

Re: Adding multiple snap lines

Post by 3+4i »

@keme: Thanks! I've been trying it out and it's exactly what I needed! It even seems more powerful than snap lines themselves, since it's more flexible: you can do anything you could with normal shapes, like changing appearance or having a snap line that only partially crosses the page.

I also found the option "Snap to Object Border" from the Options-toolbar, which actually makes things snap to the "snap"-shapes, though it's limited to the rectangular (?) frame of the shape and only works for all objects, which might not be desired when other close-by objects interfere. "Duplicate" from the Edit-menu also turned out super helpful.
LibreOffice 6.0.7.3 on Xubuntu 18.04
Post Reply