Defined in: uf_csys.h
int UF_CSYS_map_point(int input_csys, double input_point [ 3 ] , int output_csys, double output_point [ 3 ] )
Maps a point from one coordinate system to a point in another
coordinate system. The coordinate system can be one of the following
constants.
UF_CSYS_ROOT_COORDS is the ABS of the displayed part.
UF_CSYS_WORK_COORDS is the ABS of the work part.
UF_CSYS_ROOT_WCS_COORDS is the WCS of the displayed part.
For example:
To convert a point from absolute coordinates of the displayed part to
the WCS:
input_csys = UF_CSYS_ROOT_COORDS;
output_csys = UF_CSYS_ROOT_WCS_COORDS;
To convert a point from the work part absolute coordinates to the
displayed part absolute coordinates:
input_csys = UF_CSYS_WORK_COORDS;
output_csys = UF_CSYS_ROOT_COORDS;
将一个点从一个坐标系映射到另一个坐标系。坐标系可以是下列常量之一。UF _ CSYS _ ROOT _ COORDS 是显示部件的 ABS。UF _ CSYS _ WORK _ COORDS 是工作部分的 ABS。UF _ CSYS _ ROOT _ WCS _ COORDS 是显示部分的 WCS。例如: 将一个点从显示部分的绝对坐标转换为 WCS: input _ csys = UF _ CSYS _ ROOT _ COORDS; output _ csys = UF _ CSYS _ ROOT _ WCS _ COORDS; 将一个点从工作部分的绝对坐标转换为显示部分的绝对坐标: input _ csys = UF _ CSYS _ WORK _ COORDS; output _ csys = UF _ CSYS _ ROOT _ COORDS;
欢迎订阅《里海NX二次开发3000例专栏》https://blog.csdn.net/wangpaifeixingyuan/category_8840986.html,点击链接扫码即可订阅(持续更新中)。已经有几百人订阅,订阅是永久的,无限期阅读,如需帮助请私信。
int | input_csys | Input | CSYS of point to be mapped which can be: UF_CSYS_ROOT_COORDS ( Coordinate space of the root part which is the whole part being displayed), UF_CSYS_WORK_COORDS ( Coordinate space of the work part), UF_CSYS_ROOT_WCS_COORDS ( Root WCS) 要映射的点的 CSYS 可以是: UF _ CSYS _ ROOT _ COORDS (根部分的坐标空间,即显示的整个部分) ,UF _ CSYS _ WORK _ COORDS (工作部分的坐标空间) ,UF _ CSYS _ ROOT _ WCS _ COORDS (根 WCS) |
double | input_point [ 3 ] | Input | The point (xyz) to be mapped. 要映射的点(xyz)。 |
int | output_csys | Input | CSYS to be mapped to 要映射到的 CSYS |
double | output_point [ 3 ] | Output | The resultant point (xyz) of the mapping 映射的合点(xyz) |
#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);
}
效果: