Beispiel #1
0
        public override void OnDraw(GeometryBuilder dc)
        {
            dc.Clear();
            dc.Color = McDbEntity.ByObject;//color will be taken from object properties and object will be redrawn after color change

            //HostMgd.EditorInput.Editor ed = HostMgd.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //Outside rechtangle
            Polyline3d poly = new Polyline3d(new List <Point3d> {
                _pnt1, _pnt3, new Point3d(_pnt2.X, _pnt3.Y, 0), _pnt2
            });

            poly.SetClosed(true);
            for (int i = 0; i < 8; i += 2)
            {
                poly.Vertices.MakeFilletAtVertex(i, 8);
            }
            dc.DrawPolyline(poly);

            //Fl 100x15
            Polyline3d flat_bar1 = RotatedRechtangle(Fl_width, Fl_tickness, new Point3d(_pnt1.X + 95.7, _pnt1.Y + (_pnt3.Y - _pnt1.Y) / 2, 0), Angle1);
            Polyline3d flat_bar2 = RotatedRechtangle(Fl_width, Fl_tickness, new Point3d(_pnt2.X - 95.7, _pnt1.Y + (_pnt3.Y - _pnt1.Y) / 2, 0), -Angle1);

            dc.DrawPolyline(flat_bar1);
            dc.DrawPolyline(flat_bar2);

            //Side view
            Point3d pnt4_base = new Point3d(_pnt3.X, _pnt3.Y + 200, 0);

            dc.DrawPolyline(new Point3d[] { pnt4_base, new Point3d(pnt4_base.X, pnt4_base.Y + Fl_tickness, 0), new Point3d(pnt4_base.X + Fl_width, pnt4_base.Y + Fl_tickness, 0), new Point3d(pnt4_base.X + Fl_width, pnt4_base.Y + Fl_tickness, 0), new Point3d(pnt4_base.X + Fl_width, pnt4_base.Y, 0), pnt4_base });
            Point3d top_position = TopPosition(Angle2);

            dc.DrawLine(new Point3d(pnt4_base.X, pnt4_base.Y + Fl_tickness, 0), top_position);
            dc.DrawLine(new Point3d(pnt4_base.X + Fl_width, pnt4_base.Y + Fl_tickness, 0), new Point3d(top_position.X + Fl_width, top_position.Y, 0));
            //dc.DrawLine(top_position, new Point3d(top_position.X + 100, top_position.Y, 0));
            double rech_offset = (_pnt1.DistanceTo(_pnt3) - Fl_width) / 2;

            dc.DrawPolyline(new Point3d[] { new Point3d(top_position.X - rech_offset, top_position.Y, 0), new Point3d(top_position.X - rech_offset, top_position.Y + 6, 0), new Point3d(top_position.X + Fl_width + rech_offset, top_position.Y + 6, 0), new Point3d(top_position.X + Fl_width + rech_offset, top_position.Y + 6, 0), new Point3d(top_position.X + Fl_width + rech_offset, top_position.Y, 0), new Point3d(top_position.X - rech_offset, top_position.Y, 0) });

            //Fl 100x15 bottom view
            double  bottom_view_point_offset = BottomViewPointOffset1();
            Point3d rech_pnt1          = new Point3d(flat_bar1.Points[0].X - BottomViewPointOffset2(flat_bar1), flat_bar1.Points[0].Y, 0);
            Point3d rech_pnt2          = new Point3d(flat_bar2.Points[1].X + BottomViewPointOffset2(flat_bar1), flat_bar1.Points[0].Y, 0);
            Point3d bottom_view_point1 = new Point3d(rech_pnt1.X - bottom_view_point_offset, rech_pnt1.Y - (top_position.X - _pnt1.X), 0);
            Point3d bottom_view_point2 = new Point3d(rech_pnt2.X + bottom_view_point_offset, bottom_view_point1.Y, 0);

            dc.DrawLine(bottom_view_point1, bottom_view_point2);
            dc.DrawLine(bottom_view_point1, flat_bar1.Points[1]);
            dc.DrawLine(bottom_view_point2, flat_bar2.Points[0]);

            //Fl 100x15 bottom
            Polyline3d bottom_flat_bar1 = new Polyline3d(flat_bar1);
            Polyline3d bottom_flat_bar2 = new Polyline3d(flat_bar2);

            bottom_flat_bar1.TranslateBy(new Vector3d(-bottom_view_point_offset, _pnt1.X - top_position.X, 0));
            bottom_flat_bar2.TranslateBy(new Vector3d(bottom_view_point_offset, _pnt1.X - top_position.X, 0));
            dc.DrawPolyline(bottom_flat_bar1);
            dc.DrawPolyline(bottom_flat_bar2);

            //Adding remaining Lines
            dc.DrawLine(bottom_flat_bar1.Points[2], bottom_flat_bar2.Points[3]);
            dc.DrawLine(bottom_flat_bar1.Points[3], flat_bar1.Points[0]);
            dc.DrawLine(flat_bar2.Points[1], bottom_flat_bar2.Points[2]);
            double side_view_line_offset = BottomViewPointOffset2(flat_bar1) - (flat_bar1.Points[0].X - flat_bar1.Points[1].X);

            dc.DrawLine(new Point3d(pnt4_base.X + side_view_line_offset, pnt4_base.Y + Fl_tickness, 0), new Point3d(top_position.X + side_view_line_offset, top_position.Y, 0));

            //Holes
            dc.DrawCircle(new Point3d(_pnt1.X + 35, _pnt1.Y + 25, 0), 2.75);
            dc.DrawCircle(new Point3d(_pnt1.X + 35, _pnt3.Y - 25, 0), 2.75);
            dc.DrawCircle(new Point3d(_pnt2.X - 35, _pnt1.Y + 25, 0), 2.75);
            dc.DrawCircle(new Point3d(_pnt2.X - 35, _pnt3.Y - 25, 0), 2.75);
            double inbetween = Math.Round((_pnt1.DistanceTo(_pnt2) - 70) / (Count - 1), 4);

            for (int i = 1; i < Count - 1; i++)
            {
                double distance = inbetween * i;
                dc.DrawCircle(new Point3d(_pnt1.X + 35 + distance, _pnt1.Y + 25, 0), 2.75);
                dc.DrawCircle(new Point3d(_pnt1.X + 35 + distance, _pnt3.Y - 25, 0), 2.75);
            }
        }