How to set Hatch Background via script? (Pref Python)

Updating some scripts in Rhino 8, including ones that create hatches for numerous scenarios.

I’d like to control the new ability to set Hatch Backgrounds, but I haven’t found an API reference to go along with the Rhino 8 update. Anybody know how to accomplish this – I’m sure very simple-- task?

And since we’re all overachievers, here’s a fun bonus question: How would you call the Hatch Background via Macro?

Thanks,

Alan

Hi @Alan_Farkas, below seems to do it:

import Rhino
import rhinoscriptsyntax as rs
import System

hatch_id = rs.GetObject("Hatch", rs.filter.hatch, True, True)
if hatch_id:
    hatch_obj = rs.coercerhinoobject(hatch_id)
    hatch_obj.Attributes.HatchBackgroundFillColor = System.Drawing.Color.Red
    hatch_obj.CommitChanges()

i don’t think there is a way to macro this yet.
_
c.

1 Like

Thanks as always, @clement That makes sense, I’ll check it out when I’m back at the screens.

Just note that you wont see it if your hatch pattern is solid.

Not that I’ve ever done that…

:joy::rofl::joy::joy: