本文整理汇总了C++中ON_Brep::Translate方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Brep::Translate方法的具体用法?C++ ON_Brep::Translate怎么用?C++ ON_Brep::Translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Brep
的用法示例。
在下文中一共展示了ON_Brep::Translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunCommand
CRhinoCommand::result CGenCylinder::RunCommand( const CRhinoCommandContext& context )
{
Cscript1PlugIn& plugin = script1PlugIn();
if( !plugin.IsDlgVisible() )
{
return CRhinoCommand::nothing;
}
/*****************************************/
/*CHECKING IF THERE IS ALREADY A CYLINDER*/
/*****************************************/
const CRhinoLayer& layer = context.m_doc.m_layer_table.CurrentLayer();
ON_SimpleArray<CRhinoObject*> objects;
int object_count = context.m_doc.LookupObject( layer, objects );
const CRhinoBrepObject* brep_obj;
const CRhinoCurveObject* curve_obj;
const CRhinoSurfaceObject* surface_obj;
int surf_count=0;
if( object_count > 0 )
{
int brep_obj_count = 0;
int polycurve_count = 0;
const CRhinoObject* object = 0;
for(int i = 0; i < object_count; i++ )
{
object = objects[ i ];
/************************************/
/*TRY CASTING AS A RHINO BREP OBJECT*/
/************************************/
brep_obj = CRhinoBrepObject::Cast( object );
if( brep_obj && object->IsSolid())
{
brep_obj_count++;
}
/*******************************/
/*TRY CASTING AS A CURVE OBJECT*/
/*******************************/
curve_obj = CRhinoCurveObject::Cast( object );
if( curve_obj )
{
polycurve_count++;
}
//surface_obj = CRhinoSurfaceObject::Cast( object );
// if( surface_obj )
// {
//surf_count++;
// }
}
if( brep_obj_count == 0)
{
ON_3dPoint center_point( 0.0, 0.0, 0.0 );
double radius = 63.5;
int __count = plugin.m_dialog->m_comboAltTacco.GetCount();
int nIndex = plugin.m_dialog->m_comboAltTacco.GetCurSel();
CString strCBText;
plugin.m_dialog->m_comboAltTacco.GetLBText( nIndex, strCBText);
int height = _wtoi(strCBText);
ON_3dPoint height_point( 0.0, 0.0, height);
ON_3dVector zaxis = height_point - center_point;
ON_Plane planeCir( center_point, zaxis );
/*ADD CIRCLE FOR CYLINDER'S BASE*/
ON_Circle circle( planeCir, radius );
/*ADD CYLINDER*/
ON_Cylinder cylinder( circle, zaxis.Length() );
ON_Brep* brep = ON_BrepCylinder( cylinder, TRUE, TRUE );
unsigned int first_SN;
unsigned int next_SN;
if( brep )
{
first_SN = CRhinoObject::NextRuntimeObjectSerialNumber();
/********************/
/*TRANSLATE CYLINDER*/
/********************/
int nIndex1 = plugin.m_dialog->AltezzaFondelloControllo.GetCurSel();
CString strCBText1;
plugin.m_dialog->AltezzaFondelloControllo.GetLBText( nIndex1, strCBText1);
int altfondello = _wtoi(strCBText1);
ON_wString obj_nameCyl = L"CILINDRO";
brep->Translate(ON_3dVector( 0.0, 0.0, -altfondello));
CRhinoBrepObject* cylinder_object = new CRhinoBrepObject();
cylinder_object->SetBrep( brep );
if( context.m_doc.AddObject(cylinder_object) )
{
context.m_doc.Redraw();
next_SN = CRhinoObject::NextRuntimeObjectSerialNumber();
if( first_SN == next_SN )
{
return CRhinoCommand::nothing;
}
else
{
SetNametoObject(context.m_doc,first_SN,obj_nameCyl,true);
//.........这里部分代码省略.........