RH_C_FUNCTION ON_Brep* ONC_ON_BrepCone( const ON_Cone* cone, bool cap ) { ON_Brep* rc = NULL; if( cone ) { ON_Cone* pCone = const_cast<ON_Cone*>(cone); pCone->plane.UpdateEquation(); rc = ON_BrepCone(*cone, cap?1:0); } return rc; }
CRhinoCommand::result CCommandSampleCone::RunCommand( const CRhinoCommandContext& context ) { ON_Plane plane = ON_xy_plane; double height = 10.0; double radius = 5.0; BOOL bCapBottom = FALSE; ON_Cone cone( plane, height, radius ); if( cone.IsValid() ) { ON_Brep* cone_brep = ON_BrepCone( cone, bCapBottom ); if( cone_brep ) { CRhinoBrepObject* cone_object = new CRhinoBrepObject(); cone_object->SetBrep( cone_brep ); context.m_doc.AddObject( cone_object ); context.m_doc.Redraw(); } } return CRhinoCommand::success; }