iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 23977|回复: 1
打印 上一主题 下一主题

创建曲线,谁做过,zzz看一下下面的代码吧

[复制链接]
跳转到指定楼层
楼主
发表于 2004-10-22 16:56:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
如下代码是ug/api里的一个例子,但是不能画出来曲线,帮忙看一下吧
  int degree = 3;
  int periodicity = 0;
  int num_points = NUMBER_POINTS;
  /* Point/slope curve attribute array */
  UF_CURVE_pt_slope_crvatr_t point_data[NUMBER_POINTS];
  /* Arrays of user's defining point data */
  double parameters[NUMBER_POINTS] = {0.00,  0.17,  0.32,  0.45, 1.29};
  double points[3*NUMBER_POINTS] = {1.1000,  0.5320,  2.0000,
                                    1.5240,  0.6789,  2.3000,
                                    2.0000,  0.9000,  3.5956,
                                    2.3456,  1.3456,  3.7890,
                                    3.1000,  2.4567,  3.3214};
  int slopeTypes[NUMBER_POINTS] = {UF_CURVE_SLOPE_DIR,
                                   UF_CURVE_SLOPE_AUTO,
                                   UF_CURVE_SLOPE_NONE,
                                   UF_CURVE_SLOPE_DIR,
                                   UF_CURVE_SLOPE_VEC};
  double slopeVecs[3*NUMBER_POINTS] = {1.2300,  5.0506,  4.0360,
                                       0.0000,  0.0000,  0.0000,
                                       0.0000,  0.0000,  0.0000,
                                       0.5000,  1.0000,  0.5000,
                                       1.0000, -2.0000,  1.0000};
  int crvatrTypes[NUMBER_POINTS] = {UF_CURVE_CRVATR_NONE,
                                    UF_CURVE_CRVATR_AUTO_DIR,
                                    UF_CURVE_CRVATR_NONE,
                                    UF_CURVE_CRVATR_VEC,
                                    UF_CURVE_CRVATR_VEC};
  double crvatrVecs[3*NUMBER_POINTS] = {0.0000,  0.0000,  0.0000,
                                     1.0000,  2.5780,  5.6700,
                                     0.0000,  0.0000,  0.0000,
                                     1.0000,  -1.0000,  1.0000,
                                    -1.0000,  -1.0000,  -1.0000};
  int i, save_def_data = 1;
  tag_t spline_tag;
  for (i= 0;   i<NUMBER_POINTS;   i++)
  {
    point_data.point[0] = points[3*i];
    point_data.point[1] = points[3*i+1];
    point_data.point[2] = points[3*i+2];
    point_data.slope_type = slopeTypes;
    point_data.slope[0] = slopeVecs[3*i];
    point_data.slope[1] = slopeVecs[3*i+1];
    point_data.slope[2] = slopeVecs[3*i+2];
    point_data.crvatr_type = crvatrTypes;
    point_data.crvatr[0] = crvatrVecs[3*i];
    point_data.crvatr[1] = crvatrVecs[3*i+1];
    point_data.crvatr[2] = crvatrVecs[3*i+2];
  }
  /* Create B-spline curve */
    UF_CURVE_create_spline_thru_pts(degree,periodicity,num_points,point_data,parameters,save_def_data,[$spline_tag)]
  
上面的代码是在一个按钮的回调函数中的。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2004-10-22 17:22:28 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-12-25 01:15 , Processed in 0.013970 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表