测量曲面的面积之NXOpen方法(UG(NX)二次开发)

        ///


        /// 测量Face的面积和周长
        ///

        /// 被测量面
        /// 面积
        /// 周长
        public void AskFaceArea(Face face, out double area, out double perimeter)
        {
            try
            {
                Unit unit1 = (Unit)workPart.UnitCollection.FindObject("SquareMilliMeter");
                Unit unit2 = (Unit)workPart.UnitCollection.FindObject("MilliMeter");
                double accuracy = 0.5;
                IParameterizedSurface[] objects1 = new IParameterizedSurface[1];
                objects1[0] = face;
                MeasureFaces measureFaces1;
                measureFaces1 = workPart.MeasureManager.NewFaceProperties(unit1, unit2, accuracy, objects1);

                area = measureFaces1.Area;
                perimeter = measureFaces1.Perimeter;

                measureFaces1.Dispose();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
                area = perimeter = 0.0;
            }
        }

欢迎加入我的UGNX二次开发QQ群:282343540

转载于:https://www.cnblogs.com/yyFisheep/archive/2012/12/05/2802766.html

你可能感兴趣的:(c/c++)