Defined in: uf_curve.h
int UF_CURVE_ask_spline_thru_pts(tag_t spline_tag, int * degree, int * periodicity, int * num_points, UF_CURVE_pt_slope_crvatr_t * * point_data, double * * parameters )
Reads a splines defining data structure. The defining data returns
regardless of whether the spline is in or out of synchronization with its
defining data. However, if you pass the returned data structure to the
routine UF_CURVE_edit_spline_thru_pts, the spline is recreated from
the input data. Any previous change to the spline by modifying its pole
data will be discarded. If there is no defining data stored with the
spline, an error code will be returned.
The length of the array of parameters is num_points for non-periodic
curves and (num_points+1) for periodic ones.
读取定义数据结构的样条。无论样条与定义数据是否同步,定义数据都会返回。但是,如果将返回的数据结构传递给例程 UF _ CURVE _ edit _ spline _ thru _ pt,则将从输入数据重新创建样条。以前通过修改样条极点数据对样条的任何更改都将被丢弃。如果没有用样条存储的定义数据,将返回错误代码。非周期曲线的参数数组长度为 num _ points,周期曲线的参数数组长度为(num _ points + 1)。
欢迎订阅《里海NX二次开发3000例专栏》https://blog.csdn.net/wangpaifeixingyuan/category_8840986.html,点击链接扫码即可订阅(持续更新中)。已经有几百人订阅,订阅是永久的,无限期阅读,如需帮助请私信。
tag_t | spline_tag | Input | tag of spline for which to return data 要为其返回数据的样条标记 |
int * | degree | Output | degree of the spline 花键的度数 |
int * | periodicity | Output | periodicity of the spline 样条曲线的周期性 |
int * | num_points | Output | number of points and parameters in the following arrays 下列数组中的点和参数数目 |
UF_CURVE_pt_slope_crvatr_t * * | point_data | Output to UF_free | Array of data defining points and slope/curvature control. This array must be freed by passing it to UF_free. 数据定义点阵列和坡度/曲率控制。必须通过将此数组传递给 UF _ free 来释放它。 |
double * * | parameters | Output to UF_free | Parameters of the points defining the spline. This is a user specified parameterization for the spline definitions points, which needs to be monotonic increasing, but does not need to be normalized, if NULL then default parameterization will be used. This array need to be freed by calling UF_free. 定义样条的点的参数。这是一个用户为样条定义点指定的参量化,它需要单调递增,但不需要标准化,如果为空,那么将使用默认的参量化。这个数组需要通过调用 UF _ free 来释放。 |
#include
#include
#include
#include
#include
#include
//封装打印函数,用于将信息打印到信息窗口
//QQ3123197280
int ECHO(const char* szFormat, ...)
{
char szMsg[5000] = "";
va_list arg_ptr;
va_start(arg_ptr, szFormat);
vsprintf_s(szMsg, szFormat, arg_ptr);
va_end(arg_ptr);
UF_UI_open_listing_window();
UF_UI_write_listing_window(szMsg);
return 0;
}
extern DllExport void ufusr(char* param, int* returnCode, int rlen)
{
UF_initialize();
//创建块
UF_FEATURE_SIGN sign = UF_NULLSIGN;
//块起点相对于ABS
double block_orig[3] = { 0.0,0.0,0.0 };
//方向相对于WCS
char* block_len[3] = { "10", "30", "10" };
tag_t blk_obj;//体特征
UF_MODL_create_block1(sign, block_orig, block_len, &blk_obj);
int iEdit = 0;
char* size[3];
UF_MODL_ask_block_parms(blk_obj, iEdit, size);
ECHO("%s,%s,%s\n", size[0], size[1], size[2]);//输出: p6=10,p7=30,p8=10
//创建圆柱
UF_FEATURE_SIGN sign1 = UF_NULLSIGN;
double origin[3] = { 10.0,0.0,10.0 };
char height[] = "20";
char diam[] = "10";
double direction[3] = { 0,0,1 };//方向
tag_t cyl_obj_id;
UF_MODL_create_cyl1(sign1, origin, height, diam, direction, &cyl_obj_id);
int iEdit2 = 0;
char* cDiameter;
char* cHeight;
UF_MODL_ask_cylinder_parms(cyl_obj_id, iEdit2, &cDiameter, &cHeight);
ECHO("%s,%s\n", cDiameter, cHeight);//输出:p9=10,p10=20
UF_free(cDiameter);
UF_free(cHeight);
//创建圆锥
UF_FEATURE_SIGN sign2 = UF_NULLSIGN;
double origin2[3] = { 0.0,0.0,10.0 };
char height2[] = "20";
char* diam2[2] = { "10" ,"5" };
double direction2[3] = { 0,0,1 };//方向
tag_t cone_obj_id;
UF_MODL_create_cone1(sign2, origin2, height2, diam2, direction2, &cone_obj_id);
int iEdit3 = 0;
char* cD1;
char* cD2;
char* cH;
char* cAngle;
UF_MODL_ask_cone_parms(cone_obj_id, iEdit3, &cD1, &cD2, &cH, &cAngle);
ECHO("%s,%s,%s,%s\n", cD1, cD2, cH, cAngle);//输出:p11=10,p12=5,p13=20,p14=7.1250163489018
UF_free(cD1);
UF_free(cD2);
UF_free(cH);
UF_free(cAngle);
//创建球
UF_FEATURE_SIGN sign3 = UF_NULLSIGN;
double douCenter2[3] = { 0.0,0.0,30.0 };
char cDiam[] = "8";
tag_t sphere_obj_id;
UF_MODL_create_sphere1(sign3, douCenter2, cDiam, &sphere_obj_id);
int iEdit4 = 0;
char* cDiam_parm;
UF_MODL_ask_sphere_parms(sphere_obj_id, iEdit4, &cDiam_parm);
ECHO("%s\n", cDiam_parm);//输出:p15=8
UF_free(cDiam_parm);
UF_terminate();
}
extern int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
效果: