zoukankan      html  css  js  c++  java
  • C#实现“抑制”NX特征及约束

            static void SuppressedAllConstraintAndFeature(bool bSuppress)
            {
                try
                {
                    Session theSession = Session.GetSession();
                    UFSession theUfSession = UFSession.GetUFSession();
                    UFUi theUFUi = theUfSession.Ui;
    
                    string path = @"D:	est_model\_model1.prt";
                    NXOpen.Tag obj = NXOpen.Tag.Null;
                    UFPart.LoadStatus LoadStatus;
                    theUfSession.Part.Open(path, out obj, out LoadStatus);
                    NXOpen.Part part = theSession.Parts.Display;
                    
                    Feature[] features = part.Features.ToArray();
    
                    if (bSuppress)
                    {
                        part.Features.SuppressFeatures(features);
                    }
                    else
                    {
                        part.Features.UnsuppressFeatures(features);
                    }
    
                    ComponentAssembly componentAssembly = part.ComponentAssembly;
                    ComponentPositioner componentPositioner = componentAssembly.Positioner;
                    ConstraintCollection constraintCollection = componentPositioner.Constraints;
                    foreach (Constraint c in constraintCollection)
                    {
                        c.Suppressed = bSuppress;
                    }
    
                    part.Save(BasePart.SaveComponents.True, BasePart.CloseAfterSave.True);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
    作者:快雪
    本文版权归作者所有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。
  • 相关阅读:
    Callable+Future
    采用socket传输文件
    大端序和小端序
    域名
    mycat实现读写分离
    mysql存储过程
    Mysql主从同步
    centos6.5上安装5.7版本的mysql
    Mycat分库分表
    通过队列实现进程间的通信
  • 原文地址:https://www.cnblogs.com/kuaixue/p/14475632.html
Copyright © 2011-2022 走看看