示例#1
0
        private void line_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Line line = (Line)sender;

            line.Stroke = Brushes.Red;
            List <PointF> listPointsOnWall = GetListPointsOnWall(line);

            List <Line> listPerpendicularsF = tool.GetPerpendiculars(line, listPointsOnWall);

            foreach (var perpendicular in listPerpendicularsF)
            {
                canvas.Children.Add(tool.BuildInstallAxis(BoundingBoxLines, perpendicular));
            }

            gridPoints.Clear();
            gridPoints = tool.GetGridPoints(listPerpendicularsF, wallNormals);

            ElementPreview elPreview = new ElementPreview();

            Properties.Settings.Default.InstallPoints = string.Empty;
            foreach (var item in elPreview.AddElementsPreviewF(this))
            {
                double revitX = (item.X - Derrivation.X) * Scale / (25.4 * 12);
                double revitY = -(item.Y - Derrivation.Y) * Scale / (25.4 * 12);
                Properties.Settings.Default.InstallPoints += revitX + "*" + revitY + "\n";
            }
            textBoxQuantity.Text = "Items: " + CountInstallElements();

            Dimension dimension = new Dimension();

            dimension.DrawWallDimension(line, this);
            foreach (Line item in WallPartsAfterSplit(listPointsOnWall, line))
            {
                Dimension partDim = new Dimension(30, 7, HorizontalAlignment.Center);
                partDim.DrawWallDimension(item, this);
            }
        }