zoukankan      html  css  js  c++  java
  • NX二次开发 克隆

     NXOpen.UF.UFSession theUfSession = NXOpen.UF.UFSession.GetUFSession();
                    try
                    {
                        //初始化
                        NXOpen.UF.UFClone.OperationClass operationClass = NXOpen.UF.UFClone.OperationClass.CloneOperation;
                        theUfSession.Clone.Initialise(operationClass);
                        //添加原装配到克隆装配中,有Add Assembly和Add Part两种方法,此处用Add Assembly
                        NXOpen.UF.UFPart.LoadStatus loadStatus;
                        theUfSession.Clone.AddAssembly(selectPath,out loadStatus);
                        //theUfSession.Clone.AddPart(selectPath);
                        //指定默认的克隆方式
                        NXOpen.UF.UFClone.Action action = NXOpen.UF.UFClone.Action.Clone;
                        theUfSession.Clone.SetDefAction(action);
                        //指定默认文件名的方法
                        NXOpen.UF.UFClone.NamingTechnique namingTechnique = NXOpen.UF.UFClone.NamingTechnique.NamingRule;
                        theUfSession.Clone.SetDefNaming(namingTechnique);
                        //定义新装配的克隆命名规则
                        NXOpen.UF.UFClone.NameRuleDef nameRuleDef;
                        nameRuleDef.type = UFClone.NameRuleType.PrependString;
                        nameRuleDef.new_string = "M8";
                        nameRuleDef.base_string = ""; //在NX7.5版本以前,无需下面这句,但是NX7.5以后的版本中调用,必须添加下面这句,否则会显示克隆出错。
                        NXOpen.UF.UFClone.NamingFailures namingFailures;
                        theUfSession.Clone.InitNamingFailures(out namingFailures);
                        theUfSession.Clone.SetNameRule(ref nameRuleDef, ref namingFailures);
    
                        theUfSession.Clone.SetDefDirectory(@"C:	emp");
    
    
                        //string outputName = "C:\xxxxx.prt";
                        //theUfSession.Clone.SetNaming(selectPath, UFClone.NamingTechnique.DefaultNaming, outputName);
    
                        //theUI.NXMessageBox.Show("", NXMessageBox.DialogType.Information, namingFailures.n_failures.ToString());
                        theUfSession.Clone.PerformClone(ref namingFailures);
                        //theUfSession.Clone.Terminate();
                    }
                    catch (Exception ex1)
                    {
                        theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex1.ToString());
    
    
                    }
                    finally
                    {
                        theUfSession.Clone.Terminate();
                    }
    

      

  • 相关阅读:
    tcp/ip 调优示例
    【ASP.NET】IHttpHandler和IHttpModule
    【.NET框架】Dapper ORM 用法—Net下无敌的ORM
    【JavaScript】setinterval和setTimeout的区别
    【javascript】基于javascript的小时钟
    【ASP.NET】必须知道的ASP.NET核心处理
    【ASP.NET MVC】 路由机制:命名路由
    【ASP.NET MVC】提高页面加载速度:脚本优化
    SMTP协议--在cmd下利用命令行发送邮件
    【ASP.NET MVC】HTML5+MVC上传文件显示进度
  • 原文地址:https://www.cnblogs.com/bizca/p/6198257.html
Copyright © 2011-2022 走看看