Grasshopper

algorithmic modeling for Rhino

Is there any way to select POINTs by name by a C# or VB code.

such as

List<Guid> POINTAids = new List<Guid>(),XXids = new List<Guid>();
    foreach (Rhino.DocObjects.RhinoObject rhObj in Rhino.RhinoDoc.ActiveDoc.Objects.GetObjectList(new Rhino.DocObjects.ObjectEnumeratorSettings()))
    {
      Curve c = rhObj.Geometry as Curve;
      if(c != null)
        continue;
      /*Brep b = rhObj.Geometry as Brep;
      if(b == null)
      {
        Rhino.DocObjects.InstanceObject io = rhObj as Rhino.DocObjects.InstanceObject;
        // RhinoApp.Write(io.InstanceDefinition + "\r\n");
        try
        {
          Rhino.DocObjects.InstanceDefinition id = io.InstanceDefinition;// Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Find(io.Id, true);
          if(id != null)
          {
            Rhino.DocObjects.RhinoObject[] os = id.GetObjects();
            if (os != null && os.Length == 1)
            {
              b = os[0].Geometry as Brep;
            }
          }
          if(b == null)
          {
            owner.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Object not Brep" + rhObj.Id);
            continue;
          }
        }
        catch(System.Exception ex)
        {
          owner.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid Block recieved" + rhObj.Id + " " + ex);

        }
      }*/
      string str = rhObj.Attributes.Name;
      if(str.Length > 1)
      {
        if(str[1] == 'A')
          POINT-Aids.Add(rhObj.Id);
        else
          XXids.Add(rhObj.Id);
      }
    }
    POINT-A= POINT-Aids;
    XX = XXids;

Views: 254

Reply to This

Replies to This Discussion

For filtering Points by name from a rhino file, try using the "geometry pipeline" param.

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2014   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service