• 外部开发:部件属性 外部exe启动UG NX


    NX支持外部读取修改部件属性,修改后注意需要保存,UF_PART_save();

    外部exe启动UG NX            

                    1 用.net2003建立一个控制台应用程序   2 将目录ugiimanaged下除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:SiemensNX80" set UGII_LANG=simpl_chinese set UGII_ROOT_DIR="D:SiemensNX80UGII"

    D: cd "D:SiemensNX80UGII"

    set USER_STARTUP=C:TWBKFapplicationYQ_PrintPDF_Auto.dll start "UG80" "D:SiemensNX80UGIIugraf.exe"

    echo on rem pause exit

  • 相关阅读:
    "开关"组件:<h-switch> —— 快应用组件库H-UI
    "范围选择器"组件:<range> —— 快应用组件库H-UI
    "滑动选择器"组件:<h-slider> —— 快应用组件库H-UI
    "星级评分"组件:<rate> —— 快应用组件库H-UI
    "价格"组件:<price> —— 快应用组件库H-UI
    "长整数"组件:<long> —— 快应用组件库H-UI
    javaweb简单的学生信息录入系统
    java简单验证码生成程序
    请写一个java类,在任何时候都可以向它查询“你已经创建了多少个对象?”
    java静态初始化块的执行顺序
  • 原文地址:https://www.cnblogs.com/whiteIcrow/p/3857809.html
Copyright © 2020-2023  润新知