昵称:烦夫子
类别:界面/平面设计师
年龄:38
现所在地:北京
主页浏览总数:24255
总积分:89
文章数:88
作品数:70
CRhinoCommand::result CCommandmycurnote::RunCommand( const CRhinoCommandContext& context )
{
CRhinoGetObject get;
get.SetCommandPrompt( prompt_msg_0005 ); //Select curves to annotate
get.SetGeometryFilter( CRhinoGetObject::curve_object );
if( get.GetObjects( 1, 0 ) != CRhinoGet::object )
return CRhinoCommand::cancel;;
for( int i = 0; i < get.ObjectCount(); i++ )
{
CRhinoObjRef ōbjref = get.Object(i);
const ON_Curve* curve = ON_Curve::Cast( objref.Geometry() );
if( !curve )
continue;
ON_TextDot* startdot = new ON_TextDot;
ON_3dPoint startpt = curve->PointAtStart();
startdot->SetPoint( startpt );
ON_wString str;
str.Format( L"%g,%g,%g", startpt.x, startpt.y, startpt.z);
startdot->SetTextString( str );
CRhinoTextDot* pStartDot = new CRhinoTextDot();
pStartDot->SetDot( startdot );
RhinoApp().ActiveDoc()->AddObject( pStartDot, false, false );
if( curve->IsClosed() )
continue;
ON_TextDot* enddot = new ON_TextDot;
ON_3dPoint endpt = curve->PointAtEnd();
enddot->SetPoint( endpt );
str.Format( "%g,%g,%g", endpt.x, endpt.y, endpt.z);
enddot->SetTextString( str );
CRhinoTextDot* pEndDot = new CRhinoTextDot();
pEndDot->SetDot( enddot );
RhinoApp().ActiveDoc()->AddObject( pEndDot, false, false );
}
context.m_doc.Redraw();
return CRhinoCommand::success;
}