NX二次開發-使用NXOPEN C#手工搭建開發環境配置

新建類庫

進來後編譯代碼,成功

 添加NXOPEN的庫到項目中

 

 

 不同NX版本,可能dll所在位置不一樣,NX11以上版本在NXBIN這裏,NX11以下版本大概在UGII。

 添加頭文件

using NXOpen;
using NXOpen.Utilities;
using NXOpen.UF;

添加源代碼

 1 public static Session theSession;
 2 public static UFSession theUfSession;
 3 public static UFUi theUFUi;
 4 
 5 public static int Main()
 6 {
 7     theSession = Session.GetSession();
 8     theUfSession = UFSession.GetUFSession();
 9     theUFUi = theUfSession.Ui;
10 
11     theUFUi.DisplayMessage("Hello,world!", 1);
12 
13     FeatureSigns sign = FeatureSigns.Nullsign;//定義布爾
14     double[] cornet_pt = { 100.0, 0.0, 0.0 };//定義原點
15     string[] edge_len = { "100.0", "100.0", "100.0" };//定義長寬高
16     Tag blk_obj_id = Tag.Null;
17     theUfSession.Modl.CreateBlock1(sign, cornet_pt, edge_len, out blk_obj_id);
18 
19     return (0);
20 }
21 
22 public static int GetUnloadOption(string dummy)
23 {
24     return UFConstants.UF_UNLOAD_IMMEDIATELY;
25 }
26 
27 Caesar盧尚宇
28 2020年2月24日

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章