本文整理汇总了C++中ON_Brep::DestroyMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Brep::DestroyMesh方法的具体用法?C++ ON_Brep::DestroyMesh怎么用?C++ ON_Brep::DestroyMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Brep
的用法示例。
在下文中一共展示了ON_Brep::DestroyMesh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ON_BrepFace_BrepExtrudeFace
RH_C_FUNCTION ON_Brep* ON_BrepFace_BrepExtrudeFace(const ON_Brep* pConstBrep, int face_index, const ON_Curve* pConstCurve, bool bCap)
{
ON_Brep* rc = NULL;
if( pConstBrep && pConstCurve )
{
if( face_index >= 0 && face_index < pConstBrep->m_F.Count() )
{
ON_Brep* pNewBrep = ON_Brep::New( *pConstBrep );
if( pNewBrep )
{
pNewBrep->DestroyMesh( ON::any_mesh );
int result = ON_BrepExtrudeFace( *pNewBrep, face_index, *pConstCurve, bCap );
// 0 == failure, 1 or 2 == success
if( 0 == result )
delete pNewBrep;
else
rc = pNewBrep;
}
}
}
return rc;
}
示例2: RunCommand
CRhinoCommand::result CCommandSampleBrepBoxWithMesh::RunCommand( const CRhinoCommandContext& context )
{
// Get the corners of the box
CArgsRhinoGetBox args;
ON_3dPoint corners[8];
CRhinoCommand::result rc = RhinoGetBox( args, corners );
if( rc != CRhinoCommand::success )
return rc;
// Create a brep from the corners.
// Note, we are responsible for this memory.
ON_Brep* brep = ON_BrepBox( corners );
if( 0 == brep )
{
ON_Plane plane( corners[0], corners[1], corners[3] );
if( ON_ZERO_TOLERANCE > plane.plane_equation.ValueAt(corners[7]) )
RhinoApp().Print( L"Box must have a height.\n" );
return CRhinoCommand::failure;
}
// Meshing parameters to use when creating a render mesh.
const ON_MeshParameters& mp = context.m_doc.Properties().RenderMeshParameters();
// Calculates polygon mesh approximation of the brep.
// Note, we are responsible for this memory.
ON_SimpleArray<ON_Mesh*> meshes( brep->m_F.Count() );
int mesh_count = brep->CreateMesh( mp, meshes );
if( mesh_count == brep->m_F.Count() )
{
// Remove an previous values of this type of mesh.
// Note, not necessary with new ON_Brep objects.
brep->DestroyMesh( ON::render_mesh, true );
// Transfer meshes from meshes[] array to brep->m_F[].
// Note, brep will delete meshes.
for( int i = 0; i < mesh_count; i++ )
{
if( meshes[i] )
{
ON_BrepFace& face = brep->m_F[i];
// Again, not necessary with new ON_Brep objects
face.DestroyMesh( ON::render_mesh, true );
face.SetMesh( ON::render_mesh, meshes[i] );
}
}
// Create the runtime brep object
CRhinoBrepObject* brep_obj = new CRhinoBrepObject();
// Attach the brep.
// Note, object will delete brep.
brep_obj->SetBrep( brep );
// Add object to the doucment
if( !context.m_doc.AddObject(brep_obj) )
{
delete brep_obj; // Don't leak...
return CRhinoCommand::failure;
}
}
context.m_doc.Redraw();
return CRhinoCommand::success;
}