ProxyCurveIsReversed not available in RhinoIO.Net

Hello,

I need to determine if the direction of a BrepEdge is reversed. Reading this suggest to use ProxyCurveIsReversed that doesn’t seem exposed in RhinoIO.Net.

Thanks

Alex

Also, what is the best way to know the vertex index of the BrepEdge start and end point?

Thanks

Alex

I’ve added this to the to-do list.

http://mcneel.myjetbrains.com/youtrack/issue/RH-28241

I don’t see a way of doing this. I’ve added this to the same item. Why do you need this?

Hello Dale,

I kept the Brep objects last, I successfully import everything (except the angular and radial dimension because of missing members). Simple breps come in perfectly, but other are a little messed up because of edge direction.

Currently I get the edge vertex id with a simple foreach brepVertex in brepVertexList, but with very complex surface I get an out of memory exception on rhinoio.dll.

You probably get this a lot, but what sort of timeframe are we looking for that kind of to-do item? month, year?

Thanks,

Alex

I don’t know when it will be implemented. But you can track the item using the link I posted previously.

Hello Dale,

I don’t have permission to view the ticket.

Alex

I just pushed to github code that includes ProxyCurveIsReversed, StartVertex, and EndVertex on BrepEdge. This will also be available in SR10.

@alain, can you look into updating the nuget packages?

Hi @stevebaer. I updated the packages.

1 Like

That was fast! Thanks a lot guys.

Hello,
I’m having issues correctly importing Breps and I think i’ve narrowed it to the ProxyCurveIsReversed. I always asumed it was working properly and looked elsewhere for problems, but it seems to always return false. Can you confirm that I understand correctly:

For example a simple cylinder. It has 3 edges: Circle#1, Circle#2 and Line#1. When defining the cylindrical surface loop it will have 4 brep edges: Circle#1, Line#1, Circle#2 and Line#1 again. Shouldn’t at least one of two line#1 brep edge have ProxyCurveIsReversed return true?

Thanks for your help.

Alex

Hi Alex,

This is Brep cylinder something you are reading from a 3DM file, created by Rhino, into your application? Or, is it in a 3DM file written by your application that you are opening in Rhino? Can you post your 3DM file?

Regarding Loops: they are always oriented so that the active region of the Face is to the left of the 2-d curve. Thus, outer Loops are oriented counter-clockwise and inner Loops are oriented clockwise.

Also, Loops know nothing about Edges. A Loop knows the Brep Face it belongs to, and what Trims it references.

Like an Edge, a Trim is a proxy curve. Thus, it can have the opposite orientation of the Edge it belongs to.

Maybe this will help:

Hello Dale,

I’m reading in my application a Rhino file written with Rhino. See attached.

I’m sorry terminology is different from API to API. Ok let me rephrase this.

The cylinder has 3 faces. Each face has a loop that contains a brep trim list. This trim list contains breptrims that themselves point to brepedges.

The cylindrical face has one loop and this loop has a brep trim list containing 4 brep trims. Those brep trims are circle#1, line#1, circle#2 and line#1 again.

If I understand correctly the ProxyIsReversed at least one of the breptrim made with line#1 should be true? Or the breptrim.brepEdge.ProxyIsReversed should be true? With any 3DM both always return false.

To create a loop I need an array of ordered ‘Edge Curve’. An edge is composed of the int index of the Edge Curve (I use breptrim. brepEdge.EdgeIndex) and a bool flag if the edge should should use the edge curve natural direction.

Thanks

Alex
cylinder.3dm (27.2 KB)

Hi Alex,

To get the curves going in the correct direction, you need to check both BrepFace.OrientationIsReversed and BrepTrim.IsReversed. Unfortunately, I don’t see the latter being available in Rhino3dmIO (yet). I’ve added a YouTrack item to see that this happens

http://mcneel.myjetbrains.com/youtrack/issue/RH-30137

If you were using the C++ version of openNURBS, this is basically what you’d need to do:

static int RhCopyBrepFaceLoopCurves(const ON_Brep* brep, ON_SimpleArray<ON_Curve*>& out_curves)
{
  if (NULL == brep)
    return 0;

  const int out_curves_Count = out_curves.Count();

  for (int fi = 0; fi < brep->m_F.Count(); fi++)
  {
    const ON_BrepFace& face = brep->m_F[fi];
    for (int fli = 0; fli < face.LoopCount(); fli++)
    {
      ON_BrepLoop* loop = face.Loop(fli);
      if (NULL == loop)
        continue;

      for (int lti = 0; lti < loop->TrimCount(); lti++)
      {
        ON_BrepTrim* trim = loop->Trim(lti);
        if (NULL == trim)
          continue;

        // This will be NULL for singular trims.
        ON_BrepEdge* edge = trim->Edge();
        if (NULL == edge)
          continue;

        ON_Curve* crv = edge->DuplicateCurve();
        if (NULL == crv)
          continue;

        // true if the 2d trim and 3d edge have opposite orientations.
        if (trim->m_bRev3d)
          crv->Reverse();

        // true if face orientation is opposite of natural surface orientation
        if (face.m_bRev)
          crv->Reverse();

        out_curves.Append(crv);
      }
    }
  }

  return out_curves.Count() - out_curves_Count;
}

Hello Dale,

Thanks for the detailed example. I will watch the youtrack item and wait for the IsReversed addition.

Alex