Esempio n. 1
0
        /// <summary>
        /// 将CurveLoop压平在xoy平面
        /// </summary>
        /// <param name="loop"></param>
        /// <returns>如果loop不能确定一个平面,则返回空</returns>
        public static CurveLoop ProjectXoy(this CurveLoop loop)
        {
            Plane plane = null;

            try
            {
                plane = loop.GetPlane();
            }
            catch { /*loop没有在平面内*/ }

            if (plane != null && !plane.Normal.IsVertical())
            {
                return(null);
            }

            XYZ       vector    = XYZ.Zero - new XYZ(0, 0, loop.FirstOrDefault().GetEndPoint(0).Z);
            Transform transform = Transform.CreateTranslation(vector);

            return(CurveLoop.CreateViaTransform(loop, transform));
        }