We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

How to scale line width with object resizing [closed]

asked 2018-03-09 08:38:25 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I created an object in a line drawing form. When resized the image to about half the size I originally drew it the line width of the object did not scale down with the drawing. Is there a way to tell LibreDraw to scale line widths with the resizing of an object?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2021-04-23 17:46:12.142316

3 Answers

Sort by » oldest newest most voted

answered 2018-03-09 11:56:54 +0200

Regina gravatar image

No, that is not possible with drawing objects from Draw, because transformations do not affect the line width. That is one of the differences between objects by Draw and SVG-objects.

You can workaround this, if you generate a SVG-object from your drawing before resizing (File > Export; check Selection) and then use the SVG-object instead of the original drawing.

Some other ideas for workarounds: Use a common style, that you only need to adapt the line width in one place. Or do not use thick lines, but tread the lines as filled objects. That is what you get by "Convert to Contour".

edit flag offensive delete link more

answered 2018-03-09 12:20:59 +0200

Lupp gravatar image

updated 2018-03-09 12:45:29 +0200

(I do not understand what you mean by "line drawing form" or "the image" in the context.)

There is no way to define a truely relative line width relating to whatever size property, and no tool to scale the line width on resizing.

If you urgently want such scaling, you will need to create user code. This would not be exactly simple. To do auomatic scaling while resizing with the mouse may be specifically difficult and would most likely not result in reversible processes.

A more practicable way might be to set a new (absolute) line width relating to some overall size of a shape as it currently is. Problems of a different kind will arise if you want to apply the new method to GroupShape or ShapeCollection objects.

A first sketch of user code doing code as decribed for a single ungrouped shape:

Sub setLineWidthRelativeToDiagonal()
tSC   = ThisComponent.CurrentSelection
last  = tSc.Count - 1
j = -1
relLw = 1 * InputBox("Enter theRatio:", "LineWidth / TotalSize", "0.01")
' You are prompted for the input in advance of testing if it is applicable
' to any selected shape.
Do While j<last
 j = j + 1
 tSh = tSC(j)
 If NOT tSh.SupportsService("com.sun.star.drawing.Shape")      Then Goto notApplicable
 If     tSh.SupportsService("com.sun.star.drawing.GroupShape") Then Goto notApplicable
 With tSh.Size
  dX  = .Width
  dY  = .Height
 End With
 totalSize          = Sqr(dX*dX + dY*dY)
 newLw              = totalSize *relLw 
 resizeRat          = newLw / tSh.LineWidth
 tSh.LineWidth      = newLw
 tSh.LineStartWidth = tSh.LineStartWidth*resizeRat
 tSh.LineEndWidth   = tSh.LineEndWidth*resizeRat
End Sub
edit flag offensive delete link more

answered 2018-03-09 15:27:02 +0200

Grantler gravatar image

Another workaround for easy handling (no export as svg file) is:

Copy/cut the shape and then insert (Paste Special) as GDI. The lines will be scaled as well as the entire shape.

The disadvantage is that the format will change; GDI can be edited but has lost some possiblities of editing in comparison to "native" Draw objects.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-03-09 08:38:25 +0200

Seen: 1,480 times

Last updated: Mar 09 '18