Description

Matches a set of hatches to a selected existing hatch, including pattern, scale, and rotation; also matches all other object properties such as layer, display color, etc.

Author and license

Script by Mitch Heynick, 04.06.19.

Code

import rhinoscriptsyntax as rs
 
def TotalHatchMatch():
    msg="Select hatch objects to change"
    hatch_ids=rs.GetObjects(msg,rs.filter.hatch,preselect=True)
    if not hatch_ids: return
    
    hatch_match=rs.GetObject("Select hatch to match",rs.filter.hatch)
    if not hatch_match: return
    
    h_style=rs.HatchPattern(hatch_match)
    h_ang=rs.HatchRotation(hatch_match)
    h_scale=rs.HatchScale(hatch_match)
    
    rs.EnableRedraw(False)
    for hatch_id in hatch_ids:
        rs.HatchPattern(hatch_id,h_style)
        rs.HatchRotation(hatch_id,h_ang)
        rs.HatchScale(hatch_id,h_scale)
    rs.MatchObjectAttributes(hatch_ids,hatch_match)
 
TotalHatchMatch()