您现在的位置:网站首页 > 经验分享 > 基于Rhino的三维鞋业CAD软件开发[
设计师介绍:

昵称:烦夫子
类别:界面/平面设计师
年龄:37
现所在地:北京

查看该设计师的主页>>

关注好友

统计中心

主页浏览总数:24096
总积分:89
文章数:88
作品数:70

基于Rhino的三维鞋业CAD软件开发[

作者:烦夫子  更新时间: 2007-11-19   浏览人数:17578  评论:0  
分享到:
开放源码:
                            RHINO三维图形开发平台
                                     [5]

// BEGIN myline command
//

class CCommandmyline : public CRhinoCommand
{
public:
 CCommandmyline() {}
 ~CCommandmyline() {}

 UUID CommandUUID()
 {
  // {86D16F65-8E05-4316-B678-E4BD8F56DC41}
  static const GUID mylineCommand_UUID =
  { 0x86D16F65, 0x8E05, 0x4316, { 0xB6, 0x78, 0xE4, 0xBD, 0x8F, 0x56, 0xDC, 0x41 } };
  return mylineCommand_UUID;
 }

 const wchar_t* EnglishCommandName() { return L"myline"; }
 const wchar_t* LocalCommandName() { return L"myline"; }

 CRhinoCommand::result RunCommand( const CRhinoCommandContext& );
};

static class CCommandmyline themylineCommand;

CRhinoCommand::result CCommandmyline::RunCommand( const CRhinoCommandContext& context )
{
 CRhinoDoc *doc = RhinoApp().ActiveDoc();
 
 for(;;) {
  
  CRhinoGetPoint gp;

  ON_Color bkColor = RGB(255,0,0);

  gp.SetCommandPrompt(prompt_msg_0003);  //start line
  
  if ( gp.GetPoint() != CRhinoGet::point )
   break;
  
  ON_3dPoint start = gp.Point();
  
  gp.SetCommandPrompt(prompt_msg_0004);  //end line

  //设置动态画图形时的颜色
  gp.SetDynamicDrawColor ( bkColor ); 
  
  gp.DrawLineFromPoint( start, TRUE );
  
  if ( gp.GetPoint() != CRhinoGet::point )
   break;
  
  ON_3dPoint end = gp.Point();
  
  ON_Line mylin;

  mylin.Create(start,end);

  if (!mylin.IsValid())
   break;  
  
  ON_LineCurve line( mylin );

  CRhinoCurveObject* curveline = new CRhinoCurveObject();
  
  curveline->SetCurve(line);
  
  doc->AddObject( curveline, false, false );
  break;

 }
 
 context.m_doc.Redraw();

 return CRhinoCommand::success;
}

//
// END myline command

(目前有0人发表看法,  我要发表评论
我要评论:
  只有登录后才能评论!
评论者: 匿名游客    (立即登录 或 注册)