外部开发:部件属性 外部exe启动UG NX
生活随笔
收集整理的這篇文章主要介紹了
外部开发:部件属性 外部exe启动UG NX
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
NX支持外部讀取修改部件屬性,修改后注意需要保存,UF_PART_save();
?
外部exe啟動UG NX????????????
1 用.net2003建立一個控制臺應用程序?? 2 將目錄ugii\managed下除ManagedLoader.dll外的dll文件加入到你的工程里面的References?? 3 將下面的代碼復制到你的Main函數里面??????????????? theSession = Session.GetSession();??????????????????????????????? theSession.Parts.NewDisplay("d:\\1.prt",NXOpen.Part.Units.Millimeters);??????????????? NXOpen.Features.Feature nullFeatures_Feature = null;??????????????? NXOpen.Part pp=theSession.Parts.Work;??????????????? myblock = pp.Features.CreateBlockFeatureBuilder(nullFeatures_Feature) ;??????????????? Point3d ps = new Point3d(0.0, 0.0, 0.0);??????????????? myblock.SetOriginAndLengths(ps, "100", "100", "100");??????????????? myblock.CommitFeature();??????????????? NXOpen.PartSaveStatus status;??????????????? theSession.Parts.Work.Save(NXOpen.Part.SaveComponents.True,NXOpen.Part.CloseAfterSave.False, out status);?????? 4 修改項目的屬性,將輸出文件定位到ugii目錄?? 5 編譯直接運行生成的exe文件(不需要啟動UG)?? 6 在d:\下會生成文件1.prt??? using System;?? using NXOpen;?? using NXOpen.UF;?????? namespace drawBlock?? {????? class Class1????? {??????? public static Session theSession;??????? public static UFSession theUFSession;??????????? static void Main(string[] args)??????? {????????? theSession = Session.GetSession();?????????? theUFSession = UFSession.GetUFSession();?????????? theSession.Parts.NewDisplay("d:\\1.prt",NXOpen.Part.Units.Millimeters);?????????????? NXOpen.Features.Feature nullFeatures_Feature = null;?????????? NXOpen.Part pp=theSession.Parts.Work;?????????????? NXOpen.Features.BlockFeatureBuilder myblock=pp.Features.CreateBlockFeatureBuilder(nullFeatures_Feature) ;????????? Point3d ps = new Point3d(0.0, 0.0, 0.0);?????????? myblock.SetOriginAndLengths(ps, "100", "100", "100");?????????? myblock.CommitFeature();?????????? NXOpen.PartSaveStatus status;?????????? theSession.Parts.Work.Save(NXOpen.Part.SaveComponents.True,NXOpen.Part.CloseAfterSave.False, out status);??????? }????? }?? }set UGII_BASE_DIR="D:\Siemens\NX80" set UGII_LANG=simpl_chinese set UGII_ROOT_DIR="D:\Siemens\NX80\UGII\"
D: cd "D:\Siemens\NX80\UGII\"
set USER_STARTUP=C:\TWBKF\application\YQ_PrintPDF_Auto.dll start "UG80" "D:\Siemens\NX80\UGII\ugraf.exe"
echo on rem pause exit
轉載于:https://www.cnblogs.com/whiteIcrow/p/3857809.html
總結
以上是生活随笔為你收集整理的外部开发:部件属性 外部exe启动UG NX的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 理解Linux虚拟文件系统VFS
- 下一篇: MySQL中的单引号