UG/NX二次开发(C#) 一个方法遍历部件的体、面、边属性

 初学UG/NX, 对体的各种tag还不熟悉,更别说各种面、边、点的操作,感觉就像一口锅里面的饺子,根本分不清哪个是哪个。

所以,这里对体的面、边、点以及各对象进行了一次整理,废话不说,直接上代码:

1、先定义体、面、边模型

using NXOpen;
using NXOpen.Assemblies;
using NXOpen.Facet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;

namespace Auto_Init.Model
{
    /// <summary>
    /// 基本属性
    /// </summary>
    public class Base
    {
        public string StrTag { get; set; }                                   //返回对象的tag
        public Tag Tag { get; set; }
        public int Layer { get; set; }                               //返回当前对象所在层
        public bool IsOccurrence { get; set; }                       //返回此对象是否为实例
        public bool IsBlanked { get; set; }                          //返回此对象是否为空白状态
        public string Name { get; set; }                                //Returns the custom name of the object.
        public Point3d NameLocation { get; set; }                    //Returns the location of the object's name. (可能是中心点坐标)
        public string JournalIdentifier { get; set; }                //返回此对象的日志中的标识符
        public int Color { get; set; }                               //返回颜色
        public DisplayableObject.ObjectFont LineFont { get; set; }   //Returns or sets the line font of the object
        public DisplayableObject.ObjectWidth LineWidth { get; set; } //Returns or sets the line width of the object. 
        public Component OwningComponent { get; set; }               //如果此对象是引用,则返回所属组件
        public BasePart OwningPart { get; set; }                     //Returns the owning part of this object 
        public INXObject Prototype { get; set; }                     //Returns the prototype of this object if it is an occurrence. 
    }

    /// <summary>
    /// 块/体
    /// </summary>
    public class BodyModel : Base
    {
        public List<FaceModel> FaceList { get; set; }
        public FaceFlag faceFlag { get; set; }
        public double Density { get; set; }                          //密度
        public bool IsSheetBody { get; set; }                        //是否为sheet
        public bool IsSolidBody { get; set; }                        //是否为实体
        public IMessageSink NextSink { get; set; }                   //Gets the next message sink in the sink chain. 
        public Type Type { get; set; }                               //类型
        public FacetedBody facetBody { get; set; }                   //镶嵌体
        public bool upToDate { get; set; }                           //过期时间
        public Dictionary<string, FaceModel> DicFace { get; set; }   //面字典,key为面的tag
        public Dictionary<string, EdgeModel> DicEdge { get; set; }   //边字典,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MarcoPro

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值