C# ObjectArx 平移、缩放实体

平移:

        /// 
        /// 平移实体
        /// 
        /// 
        /// 偏移量
        /// 偏移量
        /// 偏移量
        public static void MoveToOffset(this Entity entity, double offsetX, double offsetY, double offsetZ = 0)
        {
            try
            {
                double[] dMatrix = new double[16];
                dMatrix[0] = 1;
                dMatrix[1] = 0.0;
                dMatrix[2] = 0.0;
                dMatrix[3] = offsetX;
                dMatrix[4] = 0.0;
                dMatrix[5] = 1;
                dMatrix[6] = 0.0;
                dMatrix[7] = offsetY;
                dMatrix[8] = 0.0;
                dMatrix[9] = 0.0;
                dMatrix[10] = 1;
                dMatrix[11] = offsetZ;
                dMatrix[12] = 0.0;
                dMatrix[13] = 0.0;
                dMatrix[14] = 0.0;
                dMatrix[15] = 1;

                Matrix3d matrix3D = new Matrix3d(dMatrix);

                entity.TransformBy(matrix3D);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

缩放:

        /// 
        /// 缩放
        /// 
        /// 
        /// 比例
        /// 基点
        public static void Scale(this Entity entity, double scale,Point3d jd)
        {
            try
            {
                entity.TransformBy(Matrix3d.Scaling(scale, jd));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

你可能感兴趣的:(C#ObjectArx,Cad,c#)