开放源码:
RHINO三维图形开发平台
[8]
// 曲线长度测量
CRhinoCommand::result CCommandCrvLen::RunCommand( const CRhinoCommandContext& context )
{
for(;;) {
CRhinoGetObject get;
if (get.GetObjects(1,0)!=CRhinoGetObject::object)
return CRhinoCommand::cancel;
CRhinoObjRef ōbj = get.Object(0);
const ON_Curve* crv = ON_Curve::Cast(obj.Geometry());
double changdo;
crv->Length(&changdo,1.0e-8,NULL);
ON_wString crv_len;
crv_len.Format( L"The Curve length is %s ", changdo );
if( context.IsInteractive() )
RhinoMessageBox( crv_len, L"curve lengh", MB_OK );
break;
}
return CRhinoCommand::success;
}
//
// END CrvLen command