NX二开ufun函数UF_MODL_create_plane(创建面)

这个ufun方法用来创建面,创建效果图如下:

1、函数结构

int UF_MODL_create_plane
(double origin_point [3],
double plane_normal [3],
tag_t * plane_tag)

2、实例源码


#include <stdio.h>
#include <uf.h>
#include <uf_part.h>
#include <uf_defs.h>
#include <uf_modl.h>
#include <uf_vec.h>


#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)
{

  char    *edge_length[3] = {"5.0", "5.0", "5.0"};
  char    *prtnam = "planes"; 

  double  dot_value;
  double  magnitude;
  double  origin[3] = {0.0, 0.0, 0.0};
  double  origin_point[3];
  double  pl1_normal[3];
  double  pl2_normal[3];
  double  unit_pl2_normal[3];
  
  tag_t   block_feat_tag;
  tag_t   part_tag;
  tag_t   plane1_tag;
  tag_t   plane2_tag;

  UF_FEATURE_SIGN create = UF_NULLSIGN;
  

  /* Open a new part */
  UF_CALL( UF_PART_new(prtnam, METRIC, &part_tag) );

  /* Create a block of dimensions 5, 5, 5 */
  UF_CALL(UF_MODL_create_block1(create, origin, edge_length, &block_feat_tag));
  
  /* Create the first plane on a face of the block */
  origin_point[0] = 0.0;
  origin_point[1] = 0.0;
  origin_point[2] = 5.0;
  
  pl1_normal[0] = 0.0;
  pl1_normal[1] = 0.0;
  pl1_normal[2] = 1.0;
  
  UF_CALL(UF_MODL_create_plane(origin_point, pl1_normal, &plane1_tag));

  /* Create the second plane on the diagonally opposite face of the block */
  origin_point[0] = 5.0;
  origin_point[1] = 5.0;
  origin_point[2] = 0.0;
  
  pl2_normal[0] = 0.0;
  pl2_normal[1] = 0.0;
  pl2_normal[2] = 1.0;
  
  UF_CALL(UF_MODL_create_plane(origin_point, pl2_normal, &plane2_tag));
} 

/*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);
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MarcoPro

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值