How does one access the current document grid settings via RhinoCommon?

I see these can be set via Rhino.DocObjects.ConstructionPlane properties, but I don’t see how to access the current settings and/or change them via scriptcontext.doc… must be missing something dumb here.

There is scriptcontext.doc.NamedConstructionPlanes, but that is only for custom CPlanes as far as I can tell.

You can get the current construction Plane

cPlane = sc.doc.Views.ActiveView.ActiveViewport.GetConstructionPlane()

then modify using those methods https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_ConstructionPlane.htm :

cPlane.GridSpacing = 40.0

And because GetConstructionPlane() seems to make a copy you need to set afterwards:

for view in sc.doc.Views:
    viewPort = view.ActiveViewport
    viewPort.SetConstructionPlane(cPlane)

sc.doc.Views.Redraw()
1 Like

OK, that’s really interesting… Even after all this time with Rhino, I never realized you can actually have a different grid spacing in each view - which is why I was looking for a global setting… Well, you learn something every day… Thanks!