Beispiel #1
0
        public static CartesianCoordinateSystem CreateCoordinateSystem(Point3d ori, Vector3d xVec, Vector3d yVec, Vector3d zVec)
        {
            NXOpen.Session theSession = NXOpen.Session.GetSession();
            NXOpen.Part    workPart   = theSession.Parts.Work;

            Matrix3x3 mat = new Matrix3x3();

            mat.Xx = xVec.X;
            mat.Xy = xVec.Y;
            mat.Xz = xVec.Z;

            mat.Yx = yVec.X;
            mat.Yy = yVec.Y;
            mat.Yz = yVec.Z;

            //Vector3d zVec = UMathUtils.VectorCross(xVec, yVec);

            mat.Zx = zVec.X;
            mat.Zy = zVec.Y;
            mat.Zz = zVec.Z;

            try
            {
                return(workPart.CoordinateSystems.CreateCoordinateSystem(ori, mat, true));
            }
            catch (Exception ex)
            {
                LogMgr.WriteLog("BoundingBoxUtils.CreateCoordinateSystem 矩阵不是正交!" + ex.Message);
                CartesianCoordinateSystem cas = workPart.CoordinateSystems.CreateCoordinateSystem(ori, xVec, yVec);
                cas.Blank();
                return(cas);
            }
        }