找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
查看: 18997|回复: 2
打印 上一主题 下一主题

[求助] ug open api 的拉伸问题 UF_MODL_create_extrusion

[复制链接]
跳转到指定楼层
1
发表于 2008-5-19 20:26:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

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

x
UF_MODL_create_extrusion
在做个开发时,要用到UF_MODL_create_extrusion
但有个问题。
我想拉伸的对象是2个区域  ,就是说又比如有8根线  分别构成了2个区域,注意他们2个区域,是不重叠的。
不存在包含关系的。  那么我拉这 8个对象,就不能成功。

而我的数组中的8根线,又是乱的 ,无法区分是属于哪个区域的。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
发表于 2008-5-19 20:27:05 | 只看该作者
******************************************************************************
             Copyright (c) 1999 - 2001 Unigraphics Solutions, Inc.
                       Unpublished - All Rights Reserved

*******************************************************************************/
/*

This example requires an open part. The code creates a unit block
and a 4-sided polygon which is extruded and unioned to the bottom
of the block.

*/

#include <stdlib.h>
#include <stdio.h>
#include <uf_curve.h>
#include <math.h>
#include <uf_modl.h>
#include <uf.h>
#define EPSILON (double)1.0e-7
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
  if (irc)
  {
     char    messg[133];
     printf("%s, line %d:  %s\n", file, line, call);
     (UF_get_fail_message(irc, messg)) ?
       printf("    returned a %d\n", irc) :
       printf("    returned error %d:  %s\n", irc, messg);
  }
  return(irc);
}
static void do_ugopen_api(void)
{
  int obj_cnt;
  char *offsets[2] = {"0.0", "0.0"};
  UF_FEATURE_SIGN mode_sign = UF_NULLSIGN;

  int i, num;
  uf_list_p_t  face_list;
  double corner_pt[3] = { 0.0, 0.0, 2.0 };
  char *edges_len[3] = { "1", "1", "1" };
  char *limits[2]={ "0", "1" };
  char *taper_angle="0.0";
  tag_t blk_eid, face;
  tag_t line1, line2, line3, line4;
  tag_t line5, line6, line7, line8;
  tag_t *objects;
tag_t generators[12];
  double pt1[3],face_dir[3],dir[3];
  UF_CURVE_line_t sline1, sline2, sline3, sline4;
  UF_CURVE_line_t sline5, sline6, sline7, sline8;

uf_list_p_t objects_list;
uf_list_p_t features_list;

int count;



  pt1[0]=0.5;
  pt1[1]=0.5;
  pt1[2]=0.0;
/* line#1 */
  sline1.start_point[0] = 0.0;
  sline1.start_point[1] = 0.0;
  sline1.start_point[2] = 0.0;
  sline1.end_point[0] = 0.0;
  sline1.end_point[1] = 1.0;
  sline1.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline1,&line1));
/* line#2 */
  sline2.start_point[0] = 0.0;
  sline2.start_point[1] = 1.0;
  sline2.start_point[2] = 0.0;
  sline2.end_point[0] = 2.5;
  sline2.end_point[1] = 3.5;
  sline2.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline2,&line2));

/* line#3 */
  sline3.start_point[0] = 2.5;
  sline3.start_point[1] = 3.5;
  sline3.start_point[2] = 0.0;
  sline3.end_point[0] = 1.0;
  sline3.end_point[1] = 0.0;
  sline3.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline3,&line3));
/* line#4 */
  sline4.start_point[0] = 1.0;
  sline4.start_point[1] = 0.0;
  sline4.start_point[2] = 0.0;
  sline4.end_point[0] = 0.0;
  sline4.end_point[1] = 0.0;
  sline4.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline4,&line4));


/* line#5 */
  sline5.start_point[0] = 3;
  sline5.start_point[1] = 3;
  sline5.start_point[2] = 0.0;
  sline5.end_point[0] = 3;
  sline5.end_point[1] = 6;
  sline5.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline5,&line5));
/* line#6 */
  sline6.start_point[0] = 3;
  sline6.start_point[1] = 6;
  sline6.start_point[2] = 0.0;
  sline6.end_point[0] = 5;
  sline6.end_point[1] = 6;
  sline6.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline6,&line6));

/* line#7 */
  sline7.start_point[0] = 5;
  sline7.start_point[1] = 6;
  sline7.start_point[2] = 0.0;
  sline7.end_point[0] = 4;
  sline7.end_point[1] = 3;
  sline7.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline7,&line7));
/* line#8 */
  sline8.start_point[0] = 4;
  sline8.start_point[1] = 3;
  sline8.start_point[2] = 0.0;
  sline8.end_point[0] = 3;
  sline8.end_point[1] = 3;
  sline8.end_point[2] = 0.0;
  UF_CALL(UF_CURVE_create_line(&sline8,&line8));

/* line 4 */
  generators[0] = line1;
  generators[1] = line2;
  generators[2] = line3;
  generators[3] = line4;

  generators[4] = line5;
  generators[5] = line6;
  generators[6] = line7;
  generators[7] = line8;




  dir[0]=0.0; dir[1]=0.0; dir[2]=1.0;


UF_MODL_create_list(&objects_list);

count=8;
for(i = 0; i < count; i++) {
    UF_MODL_put_list_item(objects_list, generators);
  }





UF_MODL_create_extruded(objects_list,taper_angle,limits,offsets,dir,mode_sign,&features_list);


/*
UF_MODL_create_extrusion(&generators[0], 8, NULL,
                                   taper_angle,limits,offsets,
                                   pt1, false,true, dir,
                                   mode_sign,&objects,&obj_cnt);
  UF_free(objects);
*/











}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int param_len)
{
  if (!UF_CALL(UF_initialize()))
  {
    do_ugopen_api();
    UF_CALL(UF_terminate());
  }
}
int ufusr_ask_unload(void)
{
  return (UF_UNLOAD_IMMEDIATELY);
}
3
发表于 2008-5-19 20:27:52 | 只看该作者
上面是代码。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2025-1-5 11:22 , Processed in 0.023954 second(s), 10 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2025 www.iCAx.org

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