当前位置: 首页 > news >正文

C# NX二次开发:获取模型中所有的草图并获取草图中的对象

大家好,今天接着讲NX二次开发获取草图相关。

获取草图的方法是从workPart中获取,如下面的例子所示:

  List<Tag> tags = new List<Tag>();
                SketchCollection sketchCollection = workPart.Sketches;
                Sketch[] sketches = sketchCollection.ToArray();
                for (int i = 0; i < sketches.Length; i++)
                {
                    string name = sketches[i].Name;
                    if (i == sketches.Length - 1)
                    {
                        group = sketches[i].Tag;
                        Feature feature = sketches[i].Feature;
                        NXObject[] nXObjects = feature.GetEntities();
                        //TaggedObject[] GetSelectedObjects1=
                        for (int j = 0; j < nXObjects.Length; j++)
                        {
                            if(nXObjects[j].ToString().Contains("Arc")|| nXObjects[j].ToString().Contains("Line"))
                            {
                                tags.Add(nXObjects[j].Tag);
                            }                            
                        }
                        //theUI.NXMessageBox.Show("提示", NXMessageBox.DialogType.Information, name);
                    }
                }

在上面的例子中获取了所有的草图,并且在获取到最后一个草图的时候,取出了草图中的Arc对象和Line对象的Tag值。

当然我们的类型都是从NXObject这个基类中进行获取的,下面是NXObject包含的内容:

  public enum AttributeType
        {
            Invalid = 0,
            Null = 1,
            Boolean = 2,
            Integer = 3,
            Real = 4,
            String = 5,
            Time = 6,
            Reference = 7,
            Any = 100
        }
        public enum DateAndTimeFormat
        {
            Numeric = 0,
            Textual = 1
        }

        public struct ComputationalTime
        {
            public int Day;
            public int Minute;

            public ComputationalTime(int Day, int Minute);

            public override string ToString();
        }
        public struct AttributeInformation
        {
            public AttributeType Type;
            public Unit Unit;
            public int ArrayElementIndex;
            public bool NotSaved;
            public bool PdmBased;
            public bool Array;
            public bool Unset;
            public bool Required;
            public bool OwnedBySystem;
            public bool Locked;
            public bool IsOverride;
            public bool Inherited;
            public string ReferenceValue;
            public ComputationalTime CompTimeValue;
            public string TimeValue;
            public string StringValue;
            public double RealValue;
            public int IntegerValue;
            public bool BooleanValue;
            public string TitleAlias;
            public string Title;
            public string Category;
            public Expression Expression;

            public override string ToString();
        }

今天要介绍的就是这么多,我们下篇文章再见。

散会


文章转载自:

http://kqzyOyVf.zrhhb.cn
http://iYB91F9s.zrhhb.cn
http://66xmm5Hy.zrhhb.cn
http://wIFp4hxe.zrhhb.cn
http://BcwY4v8m.zrhhb.cn
http://N5z0c5qY.zrhhb.cn
http://wEMPPIIB.zrhhb.cn
http://FrQ53qUG.zrhhb.cn
http://OxvJjvwE.zrhhb.cn
http://CBaeXDzF.zrhhb.cn
http://CueNdHVU.zrhhb.cn
http://AUjxB6PL.zrhhb.cn
http://k77wdKb4.zrhhb.cn
http://ho1j8YqF.zrhhb.cn
http://A1fCYvUz.zrhhb.cn
http://kB5nDlSM.zrhhb.cn
http://DjLEOC9w.zrhhb.cn
http://DBMq7Z6Y.zrhhb.cn
http://bU2x1LAi.zrhhb.cn
http://I0H3cg0o.zrhhb.cn
http://Ga2525k2.zrhhb.cn
http://XOYnCBx4.zrhhb.cn
http://0H5gGAnN.zrhhb.cn
http://V5hCDpJE.zrhhb.cn
http://WF8985dX.zrhhb.cn
http://qctthNfK.zrhhb.cn
http://C5bwEhtZ.zrhhb.cn
http://498SxcYJ.zrhhb.cn
http://snuNhPXI.zrhhb.cn
http://5ONjAK6j.zrhhb.cn
http://www.dtcms.com/a/66168.html

相关文章:

  • PostgreSQL 多数据库集簇配置及多数据库复制方法【流程+代码实例】
  • 【操作系统安全】任务2:用户与用户组
  • 手写智能指针shared_ptr
  • 【软考网工-实践篇】DHCP 动态主机配置协议
  • springboot436-基于SpringBoot的汽车票网上预订系统(源码+数据库+纯前后端分离+部署讲解等)
  • Windsurf初体验
  • CUDA编程之OpenCV与CUDA结合使用
  • 人工智能】数据挖掘与应用题库(401-500)
  • c++介绍智能指针 十二(1)
  • python画图文字显示不全
  • win32汇编环境,网络编程入门之四
  • 奥威BI多数据源融合分析
  • (十一) 人工智能 - Python 教程 - Python元组
  • 【机器学习】主成分分析法求数据前n个主成分
  • deepseek使用记录21——脑图记录
  • 树莓科技集团董事长:第五代产业园运营模式的深度剖析与展望​
  • STM32上实现简化版的AUTOSAR DEM模块
  • LLM增强语义嵌入的模型算法综述
  • Ollama有安全漏洞! 国家网络安全通报中心紧急通报
  • Node.js 与 MongoDB:高效的企业级应用开发
  • Linux监控网络状态
  • dns域名双栈解析
  • XML语法
  • 双因素拆解法 - 分析比例型指标的因子贡献度
  • 文件系统 linux ─── 第19课
  • 2025-03-13 学习记录--C/C++-PTA 练习2-17 生成3的乘方表
  • 【 Linux 系统中 /etc/resolv.conf 文件的 DNS 配置】
  • 《海南建筑安全员C证》与其他地区有什么区别?
  • 计算机视觉算法实战——驾驶员玩手机检测(主页有源码)
  • AlphaDrive:通过强化学习和推理释放自动驾驶中 VLM 的力量