Jump to content
You must now use your email address to sign in [click for more info] ×

Align Dashes to Corners and Path Ends


Recommended Posts

This is a feature available in other Design tools, and it would be nice to have it available in Affinity tool, specifically Designer.

My goal:

I want to have a box around some content, that is dashed and that the corners are symmetric around this box. The segment and the empty space in my case have the same length.

Now, let's understand a little bit on how the dashed stroke works in Affinity designer: The value you insert in the dash and phase boxes are multiples of the width of the stroke in pt units. So let's say you have a line with stroke of 2pt and you use a dash that is (2,2,0,0). The actual result are dashes that are (4pt,4pt,0,0) in your design. And phase, let's say (1), corresponds to a 2pt shift.

A more elaborate example:

- Create a rectangle that is 10mm x 20mm.
- Set the stroke to the desired width, e.g. 2 pt.
- You can then convert the rectangle to curves and break the edges using the Node Tool. But, that is not necessary if your dashes have all the same length and your rectangle has an integer aspect ratio.
- Now, you have four lines that form your rectangle. Or just a rectangle for equally spaced dashes.
- Next, specify how many dashes you want in the horizontal lines, e.g. 3.
- Then calculate the value as dash=10mm/3/0.3527777778/2/2, e.g. dash=2.3622 (which corresponds to line_length/n_segments/pt2mm/stroke_width/2).
- The phase for symmetric edges is just phase=dash/2, e.g. phase=1.1811.
- Finally, you recalculate dash and phase for the vertical lines by changing the line_length to the new line_length and scale up/down the number of segments as n_segments_new = n_segments * line_length_new / line_length.
- In this example because height and width of the box are just an integer multiple of each other you will see that recalculating dash and phase will lead to the same values of dash and phase that were obtained for the horizontal lines. If they are not integer multiples of each other, you might have to round up or down the number of segments to the nearest integer and then dash and phase will be different from those of the horizontal lines.

 

The possibility to have a button that automatically does that, would be really nice!2040987233_ScreenShot2022-07-17at10_59_25AM.thumb.png.2e088a2f66613baa869523c524392503.png 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.