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:\temp\"); //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();
}

  

最新文章

  1. [VijosP1639]机密文件 题解
  2. mysql之用户授权
  3. Python 之range 和 xrange
  4. 3.html5的文本元素
  5. ADO.NET EF实体框架
  6. Python学习 之 匿名函数
  7. scope重定义
  8. 类的访问修饰符_C#
  9. 停止Java线程,小心interrupt()方法
  10. openerp import namespace
  11. VS2008 自定义向导的default.js设置(DLL文件)
  12. 201521123017 《Java程序设计》第12周学习总结
  13. 微信小程序部署问题总结
  14. quillJS 富文本编辑器源码分析系列1
  15. selenium 不同版本Driver
  16. Spring的基础注解
  17. OC基础成员变量、属性变量、实例方法与类方法
  18. [NewLife.XCode]数据层缓存(网站性能翻10倍)
  19. SharePoint 2013 报错 异常来自 HRESULT:0X80131904
  20. python操作三大主流数据库(3)python操作mysql③python操作mysql的orm工具sqlaichemy安装配置和使用

热门文章

  1. kubernetes 安装 ingress controller
  2. Defence
  3. [考试总结]noip模拟40
  4. 初学AOP小结
  5. 从需求去理解 Linux dbus与基于dbus协议的无agent软件管理
  6. 将JAVA API接口 改写成 Python
  7. 10 个不为人知的Python冷知识
  8. 迷宫3---BFS
  9. Powershell 命令行安装 Windows 作业系统
  10. 修改 CubeMX 生成的 RT-Thread makefile 工程