昵称:烦夫子
类别:界面/平面设计师
年龄:38
现所在地:北京
主页浏览总数:24259
总积分:89
文章数:88
作品数:70
CRhinoCommand::result CCommandmyextents::RunCommand( const CRhinoCommandContext& context )
{
for(;;) {
CRhinoDoc *doc = RhinoApp().ActiveDoc();
CRhinoGetObject get;
if(get.GetObjects(1,0) != CRhinoGetObject::object)
return CRhinoCommand::cancel;
CRhinoObjRef ōbjref = get.Object(0);
const ON_Curve *crv = ON_Curve::Cast(objref.Geometry());
// 直接延长曲线
RhinoExtendCurve ( (ON_Curve*&)crv, CRhinoExtend::Arc, 0, 5);
// 曲线闭合处理
RhinoMakeCurveClosed( (ON_Curve*)crv, 0.0 );
double length = 8;
ON_3dPoint pt1 = ON_3dPoint(0,0,0) + crv->PointAtEnd();
ON_3dPoint pt2 = crv->TangentAt( crv->Domain().ParameterAt(1) ) * length + crv->PointAtEnd();
ON_LineCurve lcrv(pt1,pt2);
ON_NurbsCurve nbscrv,lnbscrv;
crv->GetNurbForm(nbscrv);
lcrv.GetNurbForm(lnbscrv);
nbscrv.Append(lnbscrv);
doc->ReplaceObject(objref,nbscrv);
doc->Redraw();
break;
}
return CRhinoCommand::success;
}
//
// END myextents command