Dashed lines unequal dash length

dashes not equal length

Please post the file…

Note that the start and end lengths of a dashed line may always be different from the specification - because they need to be stretched/shrunk to fit the curve length exactly. As you only have 3 dashes and the dash lengths/spaces are calculated from the curve start/end points, I suspect that that is what is happening on two out of the three.

Hi Mitch,

A better description would be that they have to be trimmed - they never get stretched. The dashes are centred on the curve and are juggled between a dash being at the centre or a gap being at the centre in order to get at least a partial dash at each end.

In the OP’s example we should find that the start of the circle is at the mid-point of the “long dash”, which is actually two short dashes abutting one another.

Regards
Jeremy

OK, thanks for the clarification, however, as far as I know, they can also get stretched in some cases - especially on open curves.

Mitch,

I take it back, you are absolutely right, they do stretch. For example when dash = 5 and space = 5 they stretch when the curve length is shy of a multiple of 10, for example between 65 and 70. At 70 the position shifts so you get a half dash at each end which gets longer as you lengthen the curve more, until you get to 80.

You’re more observant than me, I’d never noticed that.

Regards
Jeremy

Well, as to why I know this stuff…

Back in V4, there was a cool bonus tool called “ExplodeLinetype” - which, as its name indicates, took a curve with a linetype applied and exploded it into its component parts that you saw on the screen.

This handy tool went away in V5, never to be replaced. I had a lot of demand for this type of function for our laser cutters, so I scripted a replacement. It took me quite a bit of experimenting to get the algorithm correct. IIRC, all curves/segments must start and end with a dash, so the start/end segments are adjusted according to how that can be best fit. And, the end segment lengths are not allowed to be less than half of the original specified length, so if that happens, one segment is removed and the end segments are then stretched to fit. In some extreme cases, the end dashes can get stretched to 2-3 times the specified length.

2 Likes

Thank you all for your answers! I do understand the nature of the problem but I still don’t have a solution I can utilize to solve this problem for me. I wander, how AutoCAD and some other software solves this problem without adjusting ends of the line - maybe for next Rhino release :slight_smile:
For now, do you guys have any suggestion/script that can help me with this problem.
For example, is it possible to stretch gap between dashes rather than dashes itself? This will be better for me if possible.

What is the problem you are trying to solve?

My main requirement is that dashes must be of equal length (I can have end dashes shorter but not longer than the majority of the dashes). I can have gap between dashes stretched or/and end dashes shortened, but I have big problem when end dashes are stretched. Is it possible to stretch gap between dashes and/or to shorten end dashes rather than stretching end dashes? Thanks your your input!

No, the linetype algorithm is going to do what it is programmed to do and there’s no way to change that. When you have so few dashes on a closed curve like that it’s going to difficult to control. You can of course reduce the overall linetype scale or make a copy of the linetype definition and play with the dash length and spacing to get something better (maybe).

The problem with a closed periodic curve like a circle is that the start/end point will have two dashes abutted to each other (start+end), which in almost all cases will make a longer dash. There is no workaround for that.

If you need exact segment lengths for production or something similar, you will probably have to use Divide or a script and start actually splitting the curve to create what you need.

I made this script a while back. It should not be too difficult to adjust it for single line dashes, if that’s what you want. It will result in separated line objects though.

Hi Mitch -

Rhino 8 has ExtractLineTypeSegments.
-wim

Ah, cool, reinstated… makes my script redundant, but it’s better that way.

Thank you all for kind help :slight_smile: