Query regarding Trimmed and Untrimmed surfaces

Hello guys,
I am working on mapping Rhino entities into corresponding Parasolid entities.
I have a query regarding trimmed and untrimmed surface. Does Open NURBS API provide us any information to check if the surface is trimmed or not.
Because in Parasolid I am trying to create a trimmed sheet using the API ‘PK_SURF_make_sheet_trimmed’ where the API takes input as surface data, the trim data (have curve, curve interval, trim loop and trim set), precision and the trimming options and returns us a sheet body.
In Parasolid I can also create sheet using an API ‘PK_SURF_make_sheet_body’ where it takes input - the surface data, UVBox and returns us a sheet body.
I am not able to find any direct API in Open NURBS which tell us if the surface is trimmed or not.
Could you please let me know if there is any way to find this information in Open NURBS.
SumSurface

Hi @psomesh94,

Use ON_Brep::IsSurface(), which returns true if the Brep has a single face and that face is geometrically the same as the underlying surface (i.e. has trivial trimming). See opennurbs_brep.h for more details.

– Dale

Thank you ! @dale for the valuable suggestion. I have used the API ON_Brep::IsSurface() to decide whether the single B-Rep face is trimmed or untrimmed.
But I am working on B-Rep models which has multiple surfaces, some surfaces are trimmed and some are not. Is there any API or a way to find out whether the surface is trimmed or untrimmed.
Will you please suggest the same.

Hi @psomesh94,

Use ON_Brep::FaceIsSurface. See opennurbs_brep.h for more details.

– Dale

Thanks @dale. I have successfully used your suggested API in my code.
I have one more issue with trimming data which Rhino is providing while working on converting Rhino file to Parasolid.
Is there a way in Rhino to find which the trims are forming a close loop.
I have a model which surface is trimmed at both end. Now Rhino is giving me a single loop with all trim data.
But to make this in Parasolid I need to provide data a separate loops. So I need a way to find out which Rhino trims are forming a close loop.

Hi @psomesh94,

You can iterate through the Brep and find all of the trims that are used by the loop.

const ON_Brep* brep = ...;

for (int fi = 0; fi < brep->m_F.Count(); fi++)
{
  const ON_BrepFace& face = brep->m_F[fi];
  for (int li = 0; li < face.m_li.Count(); li++)
  {
    const ON_BrepLoop& loop = brep->m_L[face.m_li[li]];
    for (int ti = 0; ti < loop.m_ti.Count(); ti++)
    {
      const ON_BrepTrim& trim = brep->m_T[loop.m_ti[ti]];
      // todo...
    }
  }
}

Or am I not understanding your question?

– Dale

Thanks ! @dale.