Fencing Linetype

Anybody have a Linetype for Fencing? Looks sort of like this :


I got that from a Vectorworks user. It comes in as just a block of crvs. So that’s another question – how to get Linetypes from other platforms if people are willing to share with you?

As far as I know lines in Rhino can only be continuous or dashed. This pattern could probably be made with a hatch pattern, but that requires you to turn lines into thin strips and will only work with orthogonal lines. If you are fine with multiple lines then this is fairly easy to script.

like this:

show code
import rhinoscriptsyntax as rs
import scriptcontext as sc
def fenceCurve():
    """
    ---x---x---x---x---x---x---
    this script divides a curve by length and adds 'crosses' to it, grouped per curve / polyline
    www.studiogijs.nl
    """
    curves = rs.GetObjects("select curves to change into fence-style",4, preselect=True)
    if not curves:
        return
    
    
    s=sc.sticky['scale'] if sc.sticky.has_key('scale') else 20
    scale = rs.GetReal("scale of the arrow curve", s, 5, 100)
     
    
    if not scale:
        return
    sc.sticky['scale']=scale
    
    
    rs.EnableRedraw(False)    
    
    for curve in curves:
        lines=[]
        if rs.CurveLength(curve)>scale:
            pts = rs.DivideCurveLength(curve, scale)
            for pt in pts:
                t=rs.CurveClosestPoint(curve, pt)
                vec = rs.CurveTangent(curve, t)
                line = rs.AddLine(pt-vec*scale/10, pt+vec*scale/10)
                rs.RotateObject(line, pt, 45)
                lines.append(line)
                line_copy = rs.RotateObject(line, pt, 90, copy=True)
                lines.append(line_copy)
            group = rs.AddGroup()
            rs.AddObjectsToGroup(lines, group)
            rs.AddObjectsToGroup(curve, group)
            rs.SelectObjects(lines)
            rs.SelectObjects(curves)
    rs.EnableRedraw(True)
                
fenceCurve()  

Hi Alan - we have this request on the list as RH-29232 and I’ve added this thread to it.
-wim

here’s a couple more :slight_smile:

arrowCurve.py (1.5 KB) fenceCurve.py (1.4 KB) multiLineCurve.py (1.7 KB)

3 Likes

or use this gh version…

linetypes.gh (5.0 KB)

@Gijs do you think you could pep that py snake up a bit to create a partially hatched line, or at least a double curve with periodic segments that i can hatch it myself?

something like that

i created a topic not long ago about this.

@wim can you add this sample to the wish tracker?

Done!

1 Like

Thanks all. I haven’t gone into GH as of yet. But will check out those Py scripts.

Thanks again

@encephalon this was a tricky one. Still needs some testing but…

edit: script can be found here

4 Likes

nice one, thanks for the tease :smiley: glad to test it once its ready!

Hi! This is very cool! I´ve just tried it, and it seems that I can´t scale the symbols larger than 100 units. Is there a chance to dismiss this restriction?

Cheers,
Petr!

Screenshot 2020-02-13 at 11.56.44|520x40

sure thing:

scale = rs.GetReal("scale of the arrow curve", s, 5, 100)

change it there

Great! I´ll try that :slight_smile:

Thanks @Gijs

1 Like