Description

Fait correspondre un ou plusieurs hatches à un hatch existant sélectionné, y compris le motif, l’échelle et la rotation ; fait également correspondre toutes les autres propriétés de l’objet telles que le calque, la couleur d’affichage, etc.

Le script suivant fonctionne sur :

  • Rhino pour Windows ;
  • Rhino pour macOS.

Script par 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()