Example #1
0
        private void PlotPieceWise1Profile(float[] x, float[] y, Color color, float lineWeight = 1)
        {
            sketch.Edit();
            int cntX = x.GetLength(0);
            int cntY = y.GetLength(0);

            System.Diagnostics.Debug.Assert(cntX == cntY, "Размеры массивов не равны.");

            int cnt = cntX;

            Point2d[] pointArray = new Point2d[cnt];

            for (int i = 0; i != cnt; ++i)
            {
                pointArray[i] = transGeom.CreatePoint2d(ToPlotCoordX(x[i]), ToPlotCoordY(y[i]));
            }

            List <SketchLine> plotLines = new List <SketchLine>();

            for (int i = 0; i != pointArray.GetLength(0) - 1; ++i)
            {
                try
                {
                    plotLines.Add(sketch.SketchLines.AddByTwoPoints(pointArray[i], pointArray[i + 1]));
                }
                catch (System.Runtime.InteropServices.COMException e) { }
            }

            foreach (SketchLine line in plotLines)
            {
                line.LineWeight    = lineWeight;
                line.OverrideColor = color;
            }
            sketch.ExitEdit();
        }