How to access correct data of a SumSurface (hidden transformation?)

Hello,

we are trying to convert the attached ON SumSurface into our own data structure. When selecting the surface in Rhino and hitting F3, you can see the following information:


Line
start = (97.7145,0,0)
end = (97.7145,163.059,-94.1421)
domain = 0 to 188.284
line length = 188.284

This is also the information we are getting when trying to access and convert this surface in our code. But this information is actually wrong, there seems to be a hidden transformation or something like that.

When checking the surface via “Analyze - Diagnostics - List”, we can find the correct information, which is


curve3d[ 4]: ON_LineCurve domain(0,175.793) start(97.7145,-168.059,85.4819) end(97.7145,-15.8181,-2.4144)

Can anybody tell us how to access this correct information in the code?

SumSurface.3dm(77.8 KB)

TIA,
Michael

When you see a surface or a polysurface in Rhino, you are looking at a boundary representation, or Brep. In Rhino, Breps are represented with the ON_Brep class.

In looking at your object, I can see that you have a Brep with a single face. The face’s underlying surface is an ON_SumSurface.

Using the openNURBS toolkit, you can access the face’s underlying sum surface as follows:

ONX_Model model;

// TODO: open 3dm file and read model

// Iterate the object table
for( int i = 0; i < model.m_object_table.Count(); i++ )
{
  // Get reference to a model object
  const ONX_Model_Object& model_obj = model.m_object_table[i];

  // Get model object's geometry
  const ON_Object* obj = model_obj.m_object;
  if( obj )
  {
    // Try casting geomtry as a brep
    const ON_Brep* brep = ON_Brep::Cast( obj );
    if( brep )
    {
      // Get first face
      const ON_BrepFace& face = brep->m_F[0];
      // Get face's underlying surface
      const ON_Surface* srf = face.SurfaceOf();
      if( srf )
      {
        // Try casting surface as a sum surface
        const ON_SumSurface* sum_srf = ON_SumSurface::Cast( srf );
        if( sum_srf )
        {
          // TODO...
        }
      }
    }
  }
}

Keep in mind that the face has been trimmed. You will want to take this into account if you are trying to accurately convert the geometry.

Hi Dale,

thanks for your answer. Accessing the ON_SumSurface is not the problem. The problem we got is that the details of the surface we get when doing so is the same you can find in the object details (F3). But this is actually not the data we need. The details you can see if you check the surface using “Analyze - Diagnostics - List” is the one we need. It differs from the F3 data, there seems to be a translation and/or rotation involved. As the function call ON_SumSurface::toNurbsForm() delivers the correct data, there must be a possibility to find/respect this hidden translation/rotation. And this is our question: How do we get the surface data shown in “Analyze - Diagnostics - List”, resp. where can we see resp. evaluate this translation/rotation?

Thanks,
Michael

Hi Dale,

sorry, forget it, there was a bug in our code. All works now as expected, thanks!

Cheers,
Michael