Singular edges cannot be selected

Im creating a rhino command in C# that operates on brep edges. The command works fine until I select a singular edge aka micro edge. Attempting to select these degenerate edges causes the selection to be canceled. The CLI output becomes “Cannot use these objects. Removing them from selection.” I don’t care if degenerate edges cannot be selected, but Its quite annoying that my entire selection is unselected if I accidentally select a degenerate edge. Does anyone know any work arounds?

My edge selection Code:
// Select edges
var edgeGetter = new GetObject();
edgeGetter.SetCommandPrompt(“Select Brep Edges”);
edgeGetter.GeometryFilter = ObjectType.EdgeFilter;
edgeGetter.GroupSelect = true;
edgeGetter.SubObjectSelect = true;
edgeGetter.GetMultiple(1, 1000);
if (edgeGetter.Result() == GetResult.Cancel) return Result.Cancel;
ObjRef edgeObjects = edgeGetter.Objects();
if (edgeObjects.Length == 0) return Result.Cancel;

The problematic brep:
hasDegenEdges.3dm (610.6 KB)

Hi Nick,

Can you annotate the model and indicate where edge picking is failing?

You might also try a “getter” setup like this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  GetObject go = new GetObject();
  go.SetCommandPrompt("Select edges");
  go.GeometryFilter = ObjectType.Curve;
  go.GeometryAttributeFilter = GeometryAttributeFilter.EdgeCurve;
  go.GetMultiple(1, 0);
  if (go.CommandResult() != Result.Success)
    return go.CommandResult();

  foreach (ObjRef objRef in go.Objects())
  {
    BrepEdge brepEdge = objRef.Edge();
    if (null != brepEdge)
    {
      Curve curve = brepEdge.DuplicateCurve();
      if (null != curve)
      {
        Guid curveId = doc.Objects.AddCurve(curve);
        RhinoObject curveObj = doc.Objects.FindId(curveId);
        curveObj?.Select(true);
      }
    }
  }

  doc.Views.Redraw();
  return Result.Success;
}

Thanks,

– Dale

Hi Dale,

I’m not sure where the problematic edges are because I only encounter this issue when dragging to select many edges at once. When selecting the brep and running the “what” command, you’ll notice that it has 3 singular edges. I’m assuming these are the problematic edges. I cant find any rhino commands for tracking down or removing singular edges.

Also, the code that you provided has the same issue. The issue is happening during the .GetMultiple() call, thus any code after that point is not able to help.

Thanks for the help,
Nick

Hi @Nick_Drian,

Lots of Breps has singular edges. Create a sphere, using the Sphere command, and run What on the results.

The What command counts singular edges by iterating the Brep’s trim curves looking and counting trims with no edges. These trim will also be a TrimType.Singular type.

– Dale

Interesting. Well maybe singular edges are not the Issue. Thanks for the help, and I’ll let you know if I narrow down the issue.