Brep wireframe command in python


#1

hey guys
Am trying to do waffle using python via gh. And am followin the same method which i done in grasshopper. i lofted the curve using python and I want to divide the curve both in X and Y directions … so i created a bounding box around d curve and later I cud convert to curves(using brep wireframe as used in gh) which helps me in dividind d curves. But I cudn find the brep wireframe command in python which I found in gh… Help me in figuring out this guys…


(Dale Fugier) #2

I don’t know about the brep wireframe component in Grassshopper. But I will guess it is just returning all of the edge curves of a brep. This c# code example is probably very similar to what Grasshopper is doing:

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      Rhino.DocObjects.ObjRef objref;
      Result rc = Rhino.Input.RhinoGet.GetOneObject("Select Brep", false, Rhino.DocObjects.ObjectType.Brep, out objref);
      if (rc != Result.Success)
        return rc;

      Rhino.Geometry.Brep brep = objref.Brep();
      if (null == brep)
        return Result.Failure;

      foreach (Rhino.Geometry.BrepEdge edge in brep.Edges)
      {
        if (null != edge)
        {
          Rhino.Geometry.Curve curve = edge.DuplicateCurve();
          if (null != curve)
            doc.Objects.AddCurve(curve);
        }
      }

      return Result.Success;
    }

Converting this to Python should not be difficult.