码迷,mamicode.com
首页 > 其他好文 > 详细

获取实体的所有面,测量两个面角度,获取面的相邻面

时间:2018-06-26 00:58:38      阅读:296      评论:0      收藏:0      [点我收藏+]

标签:显示   lse   The   star   code   scope   play   open   编辑   

            //获取实体的所有面,测量两个面角度,获取面的相邻面
            int face_1 = 1;
            int face_2 = 5;

            TaggedObject body;
            Point3d point;

            theUI.SelectionManager.SelectTaggedObject("选择实体", "选择", Selection.SelectionScope.AnyInAssembly, false, false, out body, out point);

            Face[] faces = (body as Body).GetFaces();

            //测量两个面
            NXOpen.Unit nullNXOpen_Unit = null;
            NXOpen.MeasureAngle measureAngle1;
            measureAngle1 = theSession.Parts.Work.MeasureManager.NewAngle
                (nullNXOpen_Unit,
                faces[face_1], NXOpen.MeasureManager.EndpointType.StartPoint, 
                faces[face_2], NXOpen.MeasureManager.EndpointType.StartPoint, true, false);

            //编辑显示
            DisplayModification display = theSession.DisplayManager.NewDisplayModification();

            display.NewColor = 75;
            display.Apply(new DisplayableObject[] { faces[face_1] });

            //获取面的相邻面
            Tag[] tags;
            theUfSession.Modl.AskAdjacFaces(faces[face_1].Tag, out tags);

            NXOpen.Utilities.NXObjectManager nXObject = new NXOpen.Utilities.NXObjectManager();

            for (int i = 0; i < tags.Length; i++)
            {
                display.NewColor = 211;
                Face adjacent = (Face)nXObject.GetTaggedObject(tags[i]);
                display.Apply(new DisplayableObject[] { adjacent });
            }

 

获取实体的所有面,测量两个面角度,获取面的相邻面

标签:显示   lse   The   star   code   scope   play   open   编辑   

原文地址:https://www.cnblogs.com/wangxingzhou/p/9226585.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!