RhinoGetMeshOutline sometimes return false, but MeshOutline succeed


#1

I want to obtain a contour of mesh and use a function RhinoGetMeshOutline.
The return is sometimes false, but the command MeshOutline succeed.
In addition, Both methods is seldom not work.
Therefore, I would like to know the reason for failure. :sob:

My code:

ON_ClassArray< ON_SimpleArray<ON_PolylineCurve*> > ca_Contour;
bool bResult = false;
bResult = RhinoGetMeshOutline( InMeshes, view_list[0], 0.1, ca_Contour);
if( !bResult )
{
	RhinoApp().Print( L"RhinoGetMeshOutline Fail!/n" );
	return CRhinoCommand::failure;
}
    
for( int i = 0; i < InMeshes.Count(); i++ ) 
{
   ON_SimpleArray<ON_PolylineCurve*> *A1 = ca_Contour.At(i);
   for( int j=0; j < A1->Count(); j++ ) 
   {
       ON_PolylineCurve** A2 = A1->At(j);
       context.m_doc.AddCurveObject( *((*A2)->DuplicateCurve()) );
   }

}

probSTL.3dm (4.9 MB)
Fail.mp4 (6.7 MB)


(Dale Fugier) #2

Let me know if this sample is helpful (or not):

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleMeshOutline.cpp


#3

I note the tolerance your setting is tiny. Right ?
But the fail still happens.
The under image includes the camera position and direction and target point.
May it help you to find the reason ?

The under image can’t get any contour through your method and MeshOutline.

Fail video:
Fail_2.mp4 (2.3 MB)


(Dale Fugier) #4

Does the MeshOutline command also fail in these views? Can you provide a 3DM file with Named Views that fail?


#5

Hi Dale !
Thank you for help.
First, Yes, the command is also fail.
This 3DM file ( probSTL.3dm ) had been posted in my first article.

I found the position and direction of camera appear to affect the result.
Although many conditions will succeed to obtain the outline.
I hope it help to you.


(Dale Fugier) #6

When I open the model you posted (probSTL.3dm), the MeshOutline command works (in the Top view).

What I want is the model oriented so that the MeshOutline command does not work. Does this make sense?

Note, if the MeshOutline command fails, so will the RhinoGetMeshOutline() function


#7

I got it.
Please check it out !
probSTLOrient.3dm (5.0 MB)
probSTLOrient2.3dm (5.0 MB)


(Dale Fugier) #8

I’ve reported this as a bug. You can track the item here:

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


#9

Thanks you for help.
Though… :scream: I don’t really want to hear this result.
Can any process replace this function ?


(Dale Fugier) #10

I’m not sure if I understand this question…