Hiding control point from RhinoCommon

I’m talking about this option here:
image

Is this possible to do using Python?

Since you are scripting, an easy way is to just script the HidePt command.

– Dale

Hi Dale, does that mean this is not possible using RhinoCommon?
I do not want to script commands unless I have no other choice. (like for example using squish command. Or the Hydrostatics command.

A bit about the background I have developed a bundle of scripts for grips and eventually I want to turn this into a plugin.

A grip is just like any other object. So you can hide it in same manner.

– Dale

Is this something new? Before grips didn’t have guid, they were not objects like points.

@dale,

The following code is hiding all points not just the grip (control point) I’ve selected.

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs


pt = rs.GetObjectGrip()
print pt[0]

#Rhino.DocObjects.Tables.ObjectTable.Hide(pt[0],True)
sc.doc.Objects.Hide(pt[0],True)

Fun with grips:

import Rhino
import scriptcontext as sc

def test_hide_pt():
    go = Rhino.Input.Custom.GetObject();
    go.SetCommandPrompt("Select control points to hide")
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Grip
    go.SubObjectSelect = False
    go.GetMultiple(1, 0)
    if (go.CommandResult() == Rhino.Commands.Result.Success):
        for objref in go.Objects():
            sc.doc.Objects.Hide(objref, False)
        sc.doc.Views.Redraw()

def test_show_pt():
    filter = Rhino.DocObjects.ObjectEnumeratorSettings()
    filter.NormalObjects = False
    filter.LockedObjects = False
    filter.HiddenObjects = True
    filter.DeletedObjects = False
    filter.ActiveObjects = True
    filter.ReferenceObjects = True
    filter.IncludeGrips = True
    rh_objects = sc.doc.Objects.GetObjectList(filter)
    for rh_obj in rh_objects:
        if not rh_obj.IsHidden: 
            continue
        if rh_obj.ObjectType != Rhino.DocObjects.ObjectType.Grip: 
            continue;
        sc.doc.Objects.Show(rh_obj.Id, False)
    sc.doc.Views.Redraw()

– Dale

3 Likes

Thanks @dale,

This is exactly what I needed.