Problem with SetLinetypeScale


#1

Imagine that you have changed linetype of a curve from continuous to hidden, but the curve still looks continuous. You use SetLinetypeScale to change the linetype scale from 1 to 10, but the curve still looks continuous. You change the linetype scale to 100. The curve still looks continuous. You change the linetype scale to 1000. The curve still looks continuous. You change the linetype scale to 0.1. The curve still looks continuous. You change the linetype scale to 0.01. Now, at last, the curve looks hidden…

It would be much more convenient to set linetype distance instead of the linetype scale. You would just click twice to show the distance, and you would get exactly what you wanted.


#2

Here is a script which might help. It will prompt you to pick an object with the linetype you want, then prompt you for either a distance input (keyboard input single number) or two points picked on-screen to determine the distance. The linetype scale is then adjusted to match the input distance.

Note:

  1. Linetype pattern definitions can include any number of arbitrary length “pen down” dashes, arbitrary length “pen up” spaces and zero-length dots in any order (Type-A linetypes always start with a line segment, but it’s not required). The pattern is repeated along the chosen curves; in addition Rhino adjusts the ends to fit to the curve length.

  2. Ergo, it’s not easy to determine the length of an individual drawn segment - it might be 0 or a space - what can be determined easily is the entire pattern definition length before it repeats. In the case of a simple dashed line, this would be the line length plus the space distance.

  3. Linetype patterns in Rhino are always specified in mm (IIRC).

  4. Linetype scale is set document-wide in Rhino, it cannot be set per-object

The script simply looks at the pattern definition of the chosen linetype and gets the total length of one repetition, then changes the linetype scale so that that length is what you specify. It reports the preceding linetype scale and the new one that has been set.

SetLinetypeScaleByDistance.py (2.1 KB)

–Mitch


#3

In my opinion this script is not useful. What we need is automatic scaling of all linetype pattern definitions, so that total length of each definition equals 1. (I am familiar with the linetype pattern definitions because I used AutoCAD full time for about 13 years.)


#4

You can do that yourself. You just need to open the various linetype files and scale the values. Rhino only reads linetype files, it does not modify them. I would just modify existing linetypes or create new ones as needed, then store them in your document template(s) for re-use.

Edit - actually this is easier than I thought - you can just edit the linetypes in DocumentProperties and then save as a template.

And also, this doesn’t really make much sense in the real world… If you want to have for example both long and short dash linetypes in the same document, having them all the same pattern length doesn’t really work…


#5

Good idea!

In the past I made three versions of the same linetype: short, medium, and long. It was fast work.