Пример #1
0
Файл: Data.cs Проект: AMEE/revit
        /// <summary>
        /// Generate 2D data for preview pane.
        /// </summary>
        private void Generate2D()
        {
            ArrayList tempArray = new ArrayList();
            double xMin = 0;
            double xMax = 0;
            double yMin = 0;
            double yMax = 0;

            foreach (Curve c in Profile)
            {
               List<XYZ> xyzArray = c.Tessellate() as List<XYZ>;
               foreach (Autodesk.Revit.DB.XYZ xyz in xyzArray)
                {
                    Autodesk.Revit.DB.XYZ temp = new Autodesk.Revit.DB.XYZ (xyz.X, -xyz.Y, xyz.Z);
                    FindMinMax(temp, ref xMin, ref xMax, ref yMin, ref yMax);
                    tempArray.Add(temp);
                }
            }

            MaxLength = ((xMax - xMin) > (yMax - yMin)) ? (xMax - xMin) : (yMax - yMin);

            Points = new PointF[tempArray.Count / 2 + 1];
            for (int i = 0; i < tempArray.Count; i = i + 2)
            {
                Autodesk.Revit.DB.XYZ point = (Autodesk.Revit.DB.XYZ)tempArray[i];
                Points.SetValue(new PointF((float)(point.X - xMin), (float)(point.Y - yMin)), i / 2);
            }
            PointF end = (PointF)Points.GetValue(0);
            Points.SetValue(end, tempArray.Count / 2);
        }