其他分享
首页 > 其他分享> > NX/UG二次开发—分析—测量面的面积的两种方法介绍

NX/UG二次开发—分析—测量面的面积的两种方法介绍

作者:互联网

第一种方法(C#):

    public static double GetFaceArea(Tag t_face)
    {
        Face face = (Face)theNXManager.GetTaggedObject(t_face);
        NXOpen.Part workPart = theSession.Parts.Work;
        NXOpen.MeasureFaces measureFace1;

        NXOpen.IParameterizedSurface[] faceArea = new NXOpen.IParameterizedSurface[1];
        faceArea[0] = face;
        
        NXOpen.UnitCollection uniCol = workPart.UnitCollection;
        NXOpen.Unit[] uniList = uniCol.ToArray();
        Unit unit1 = uniList[0];
        measureFace1 = workPart.MeasureManager.NewFaceProperties(unit1, unit1, 0.2, faceArea);
        double dis = measureFace1.Area;

        return dis;
    }

第二种方法,导出函数从libgeom.dll中导出?MEASURE_calculate_area_of_faces@@YAHHPEAINPEAN1@Z测量多个面(C++)

typedef int(*MEASURE_calculate_area_of_faces) (int 个数, unsigned int *面的tag指针, double 公差, double *面的面积, double *面的估计误差);

测量单个面使用?MEASURE_ask_face_area@@YANIN@Z

标签:area,int,double,workPart,face,NX,NXOpen,二次开发,UG
来源: https://blog.csdn.net/u012077233/article/details/110183359