【NX二次开发】拉伸的偏置方向猜想与验证
结论:偏置的方向为曲线方向与拉伸方向的向量叉乘。
在UF_MODL_create_extrusion帮助中有这么一句话:Note that the offset direction is determined by the cross product of the direction vector of the first profile segment and the extrusion direction vector.偏移方向由“第一剖面段的方向向量”和“拉伸方向向量”的叉积决定。
猜想一下:
向量叉乘的右手定则:
验证1:
验证2:
验证3:
测试源码:
//拉伸生成片体 UF_MODL_ask_extrusion extern DllExport void ufusr(char *param, int *returnCode, int rlen) { UF_initialize(); uc1601("拉伸", 1); //tag_t tagLine = 45256; tag_t tagLine = 45950; double douAngle = 0.0; char cTaperAngle[256] = ""; sprintf(cTaperAngle, "%f", douAngle); double douLimit0 = 0.0; double douLimit1 = 10.0; char Limit0[256] = ""; sprintf(Limit0, "%f", douLimit0); char Limit1[256] = ""; sprintf(Limit1, "%f", douLimit1); tag_t objects[1] = { tagLine }; int object_count = 1; char *taper_angle = cTaperAngle; char *Limit[2] = { Limit0,Limit1 }; char * offsets[2] = { "20","0" }; double Point2[3] = { 0.0, 0.0, 0.0 }; double douDir[3] = { 0.0, 0.0, 1.0 };//拉伸方向 UF_FEATURE_SIGN Sign1 = UF_NULLSIGN; tag_t *outObjects = NULL; int iFeaturesCount = 0; UF_MODL_create_extrusion(objects, object_count, NULL, taper_angle, Limit, offsets, Point2, false, false, douDir, Sign1, &outObjects, &iFeaturesCount); UF_terminate(); } extern int ufusr_ask_unload(void) { return (UF_UNLOAD_IMMEDIATELY); }