摘要:
#NX二次开发-获取集成环境下打开的part名 UI编辑器里的“通过浏览选择文件”控件只能选择本地的part文件,如果我们需要选择集成环境下的part文件,很显然这个控件不能满足我们的要求,那么我们就需要通过自己组合控件来达到相应的需求,最终实现的效果如下所示: 操作步骤如下: 首先自己组合控件,我 阅读全文
posted @ 2020-12-14 15:45
不再低调
阅读(468)
评论(0)
推荐(0)
摘要:
#NX二次开发-NX是否处于集成环境下 1 bool IsUgmanagerActive() 2 { 3 logical isActive = false; 4 UF_is_ugmanager_active(&isActive); 5 6 return isActive; 7 } 阅读全文
posted @ 2020-12-14 15:42
不再低调
阅读(355)
评论(0)
推荐(0)
摘要:
#NX二次开发-通过NX自带UI分别获取集成环境和本地打开的part名字 通过NX自带UI获取集成环境下打开的part名字; 1 string GetOpenPartName() 2 { 3 char fileName[MAX_FSPEC_BUFSIZE] = ""; 4 logical unuse 阅读全文
posted @ 2020-12-14 14:40
不再低调
阅读(469)
评论(0)
推荐(0)
摘要:
#NX二次开发-坐标系转换 从CSYS转换到ACS; 1 void MapPointFromCsysToAcs(tag_t csys, double* point) 2 { 3 if (NULL_TAG == csys) 4 { 5 return; 6 } 7 8 double csysOrigin 阅读全文
posted @ 2020-12-14 14:36
不再低调
阅读(714)
评论(0)
推荐(0)
摘要:
#NX二次开发-拆分路径为文件夹和文件名 1 void SplitFileName(std::string fullName, std::string &dirName, std::string &fileName) 2 { 3 TrimString(fullName); 4 dirName.cle 阅读全文
posted @ 2020-12-14 14:22
不再低调
阅读(374)
评论(0)
推荐(0)
摘要:
#NX二次开发-获取当前dll的项目路径、获取配置文件路径 获取当前dll的项目路径; 1 string NXCommon::GetUserDir() 2 { 3 std::string dll = GetHostName(); 4 string dir, fname; 5 SplitFileNam 阅读全文
posted @ 2020-12-14 14:18
不再低调
阅读(733)
评论(2)
推荐(0)
摘要:
#NX二次开发-克隆装配 克隆操作 1 string CloneAssemble(const string & fileName, const string & outputDirectory, bool isDryrun) 2 { 3 //设置操作类型 4 UF_CLONE_operation_c 阅读全文
posted @ 2020-12-14 14:05
不再低调
阅读(1209)
评论(0)
推荐(0)
摘要:
#NX二次开发-获取装配根节点、所有子节点、部件原型 获取装配根节点tag; 1 tag_t GetRootComponent(tag_t part) 2 { 3 if (NULL_TAG == part) 4 { 5 return NULL_TAG; 6 } 7 8 return UF_ASSEM 阅读全文
posted @ 2020-12-14 13:49
不再低调
阅读(1897)
评论(0)
推荐(0)
摘要:
#NX二次开发-以指定字符分割字符串 1 std::vector<std::string> SplitString(std::string str, const std::string& seperator) 2 { 3 std::vector<std::string> result; 4 int 阅读全文
posted @ 2020-12-14 13:30
不再低调
阅读(375)
评论(0)
推荐(0)
摘要:
#NX二次开发-获取当前项目路径 1 std::string AskProjectPath() 2 { 3 char* userDir = NULL; 4 UF_translate_variable("UGII_USER_DIR", &userDir); 5 if (userDir == NULL) 阅读全文
posted @ 2020-12-14 13:27
不再低调
阅读(532)
评论(0)
推荐(0)
摘要:
#NX二次开发-根据文件名删除文件 1 void DeleteFileByFileName(const std::string& fileName) 2 { 3 if (CheckFileExist(fileName)) 4 { 5 remove(fileName.c_str()); 6 } 7 } 阅读全文
posted @ 2020-12-14 13:25
不再低调
阅读(308)
评论(0)
推荐(0)
摘要:
#NX二次开发-写入信息窗口 1 void WriteLW(const std::string& str) 2 { 3 NXOpen::ListingWindow *lw = Session::GetSession()->ListingWindow(); 4 if (!lw->IsOpen()) 5 阅读全文
posted @ 2020-12-14 13:23
不再低调
阅读(311)
评论(0)
推荐(0)
摘要:
#NX二次开发-读文件 1 bool ReadFile(const std::string& fileName, std::vector<std::string>& txtLines) 2 { 3 if (!CheckFileExist(fileName)) 4 { 5 return false; 阅读全文
posted @ 2020-12-14 13:18
不再低调
阅读(484)
评论(0)
推荐(0)
摘要:
#NX二次开发-获取NX里的对象信息 以获取曲线的对象信息为例,实现代码如下。 1 void GetCurveInfo(tag_t curve, vector<string> &infoStrings) 2 { 3 infoStrings.clear(); 4 5 if (curve == NULL 阅读全文
posted @ 2020-12-14 13:09
不再低调
阅读(1217)
评论(0)
推荐(0)