Dimension Masking via python

Trying to set the mask to solid color via python (Rhinocode/ScriptEditor in R8 py3.9) - not able to get where I need to go. Editing the style or dim itself is acceptable. Appreciate the help!

Hi @dushea, below seems to do it:

import Rhino
import rhinoscriptsyntax as rs
from System.Drawing import Color

def DoSomething():

    dim_id = rs.GetObject("Select dimension", rs.filter.annotation, True, False)
    if not dim_id: return
    
    dim_obj = rs.coercerhinoobject(dim_id, True, True)
    if not isinstance(dim_obj, Rhino.DocObjects.DimensionObject): return
    
    dim_obj.Geometry.MaskEnabled = True

    new_style = Rhino.DocObjects.DimensionStyle()
    new_style.CopyFrom(dim_obj.Geometry.DimensionStyle)
    new_style.MaskColorSource = Rhino.DocObjects.DimensionStyle.MaskType.MaskColor
    new_style.MaskColor = Color.CornflowerBlue
    dim_obj.Geometry.SetOverrideDimStyle(new_style)
    dim_obj.CommitChanges()
    
DoSomething()

_
c.

Thank you for this! Worked perfectly! Where is the API documentation for these methods? Seems like I need to do some reading.

Thanks again!

Hi @dushea, you might start here:

https://developer.rhino3d.com/api/rhinocommon/

_
c.