public override void OnDraw(GeometryBuilder dc) { dc.Clear(); // Define the basic points for drawing Point3d pnt1 = new Point3d(0, 0, 0); Point3d pnt2 = new Point3d(pnt1.X + (984 * _scale), pnt1.Y, 0); Point3d pnt3 = new Point3d(pnt2.X + 0, pnt1.Y + (50 * _scale), 0); Point3d pnt4 = new Point3d(pnt1.X, pnt3.Y, 0); // Set the color to ByObject value dc.Color = McDbEntity.ByObject; Vector3d hvec = new Vector3d(0, 0, _h * _scale); // Draw the upper and lower sides dc.DrawPolyline(new Point3d[] { pnt1, pnt2, pnt3, pnt4, pnt1 }); dc.DrawPolyline(new Point3d[] { pnt1.Add(hvec), pnt2.Add(hvec), pnt3.Add(hvec), pnt4.Add(hvec), pnt1.Add(hvec) }); // Draw the edges dc.DrawLine(pnt1, pnt1.Add(hvec)); dc.DrawLine(pnt2, pnt2.Add(hvec)); dc.DrawLine(pnt3, pnt3.Add(hvec)); dc.DrawLine(pnt4, pnt4.Add(hvec)); // Drawing a Door Handle dc.DrawLine(pnt2.Add(new Vector3d(-190 * _scale, -0, _h * 0.45 * _scale)), pnt2.Add(new Vector3d(-100 * _scale, 0, _h * 0.45 * _scale))); dc.DrawLine(pnt3.Add(new Vector3d(-190 * _scale, 0, _h * 0.45 * _scale)), pnt3.Add(new Vector3d(-100 * _scale, 0, _h * 0.45 * _scale))); }
public override void OnDraw(GeometryBuilder dc) { dc.Clear(); dc.Color = McDbEntity.ByObject; _blockRef[0].DbEntity.Erase(); _blockRef[1].DbEntity.Erase(); _blockRef[0].InsertPoint = _pnt1; _blockRef[0].DbEntity.AddToCurrentDocument(); double inbetween = Math.Round(_pnt1.DistanceTo(_pnt2) / (Count + 1), 4); for (int i = 1; i <= Count; i++) { double distance = inbetween * i; _blockRef[i + 1].DbEntity.Erase(); _blockRef[i + 1].InsertPoint = new Point3d(_pnt1.X + distance, _pnt1.Y, 0).Rotate(_pnt1, _pnt1.AngleTo(_pnt2)); _blockRef[i + 1].DbEntity.AddToCurrentDocument(); } _blockRef[1].InsertPoint = _pnt2; _blockRef[1].DbEntity.AddToCurrentDocument(); dc.Color = System.Drawing.Color.Cyan; dc.DrawLeader(_pnt2, _pnt1, Arrows.Arrow, 5); }
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 //dc.DrawPolyline(new Point3d[] { _pnt, _pnt1, _pnt2, _pnt3, _pnt }); //dc.DrawPolyline(poly.GetTrimmedOffset(Height)[0]); BendingShape shape1 = new BendingShape(_pnt, _pnt1, Height, Thickness, Gap); BendingShape shape2 = new BendingShape(_pnt1, _pnt2, Height, Thickness); BendingShape shape3 = new BendingShape(_pnt2, _pnt3, Height, Thickness, Gap); BendingShape shape4 = new BendingShape(_pnt3, _pnt, Height, Thickness); Polyline3d poly = new Polyline3d(new List <Point3d> (shape1.Shape)); poly.AddPoliline(new Polyline3d(new List <Point3d>(shape2.Shape))); poly.AddPoliline(new Polyline3d(new List <Point3d>(shape3.Shape))); poly.AddPoliline(new Polyline3d(new List <Point3d>(shape4.Shape))); poly.SetClosed(true); //CircArc3d test = new CircArc3d(_pnt1, new Vector3d(), new Vector3d(), 0.25, ((180 + _pnt.AngleTo(_pnt1)) * Math.PI / 180), (_pnt.AngleTo(_pnt1) * Math.PI / 180)); //dc.DrawArc(test); //dc.DrawArc(_pnt1, 0.25, ((180+_pnt1.AngleTo(_pnt2)) * Math.PI/180), (_pnt1.AngleTo(_pnt2) * Math.PI/180)); Polyline3d.VertexDataOfPolyline polyVertecies = poly.Vertices; for (int i = 0; i < polyVertecies.Count; i++) { polyVertecies.MakeFilletAtVertex(i + 1, Radius); } dc.DrawPolyline(poly); }
public override void OnDraw(GeometryBuilder dc) { dc.Clear(); dc.Color = McDbEntity.ByObject; dc.DrawPolyline(new ConShape(poly.Points.FirstPoint, poly.Points.LastPoint, Thickness, Length, Margin, Count).Shape); }
public override void OnDraw(GeometryBuilder dc) { dc.Clear(); dc.Color = McDbEntity.ByObject; dc.DrawCircle(_basePnt, _radius); dc.DrawCircle(_basePnt, _radius / 2.0); dc.TextHeight = 31; dc.DrawMText(_basePnt, Vector3d.XAxis, _predText, HorizTextAlign.Center, VertTextAlign.Center, _radius / 2.05); }
public override void OnDraw(GeometryBuilder dc) { dc.Clear(); // Define the basic points for drawing Point3d pnt1 = _pnt1; Point3d pnt2 = new Point3d(_pnt2.X, pnt1.Y, 0); Point3d pnt3 = new Point3d(pnt2.X, pnt1.Y + 150, 0); Point3d pnt4 = new Point3d(pnt1.X, pnt3.Y, 0); // Set the color to ByObject value dc.Color = McDbEntity.ByObject; Vector3d hvec = new Vector3d(0, 0, _h); // Draw the upper and lower sides dc.DrawPolyline(new Point3d[] { pnt1, pnt2, pnt3, pnt4, _pnt1 }); dc.DrawPolyline(new Point3d[] { _pnt1.Add(hvec), pnt2.Add(hvec), pnt3.Add(hvec), pnt4.Add(hvec), pnt1.Add(hvec) }); // Draw the edges dc.DrawLine(pnt1, pnt1.Add(hvec)); dc.DrawLine(pnt2, pnt2.Add(hvec)); dc.DrawLine(pnt3, pnt3.Add(hvec)); dc.DrawLine(pnt4, pnt4.Add(hvec)); // Create contours for the front and rear sides and hatch them // In this demo, we hatch only two sides, you can tailor the others yourself List <Polyline3d> c1 = new List <Polyline3d>(); c1.Add(new Polyline3d( new List <Point3d>() { pnt1, pnt1.Add(hvec), pnt2.Add(hvec), pnt2, pnt1, })); dc.DrawGeometry(new Hatch(c1, "BRICK", 0, 20, false, HatchStyle.Normal, PatternType.PreDefined, 30), 1); List <Polyline3d> c2 = new List <Polyline3d>(); c2.Add(new Polyline3d( new List <Point3d>() { pnt4, pnt4.Add(hvec), pnt3.Add(hvec), pnt3, pnt4, })); dc.DrawGeometry(new Hatch(c2, "BRICK", 0, 20, false, HatchStyle.Normal, PatternType.PreDefined, 30), 1); }
public override void OnDraw(GeometryBuilder dc) { dc.Clear(); dc.Color = McDbEntity.ByObject; Polyline3d poly = new Polyline3d(new List <Point3d> { _pnt1, _pnt2 }); double gap = Thickness < 0 ? Gap * -1 : Gap; poly = _Inside ? poly.GetTrimmedOffset(Offset - gap)[0] : poly; ConShape shape = new ConShape(poly.Points.FirstPoint, poly.Points.LastPoint, Thickness + gap * (_Inside ? 2 : 1), Length + Gap * 2, Margin - Gap, Count); for (int i = 1; i < Count + 1; i++) { dc.DrawPolyline(shape.polyline(i, _Inside)); } }
public override void OnDraw(GeometryBuilder dc) { dc.Clear(); dc.Color = McDbEntity.ByObject; BendingShape shape1 = new BendingShape(_pnt1, _pnt2, Height, Thickness, Gap); //BendingShape shape2 = new BendingShape(_pnt1, _pnt2, Height, Thickness); Polyline3d poly = new Polyline3d(new List <Point3d>(shape1.Shape)); //poly.SetClosed(true); Polyline3d.VertexDataOfPolyline polyVertecies = poly.Vertices; for (int i = 0; i < polyVertecies.Count; i++) { polyVertecies.MakeFilletAtVertex(i + 1, Radius); } dc.DrawPolyline(poly); }
public override void OnDraw(GeometryBuilder dc) { dc.Clear(); dc.Color = McDbEntity.ByObject; Polyline3d poly = new Polyline3d(new List <Point3d> { _pnt, _pnt1, _pnt2, _pnt3, _pnt }); Polyline3d poly_offset = poly.GetTrimmedOffset(-Width)[0]; dc.DrawPolyline(poly); dc.DrawPolyline(poly_offset); dc.DrawLine(_pnt, poly_offset.Points[0]); dc.DrawLine(_pnt1, poly_offset.Points[1]); dc.DrawLine(_pnt2, poly_offset.Points[2]); dc.DrawLine(_pnt3, poly_offset.Points[3]); if (Thickness != 0) { dc.DrawPolyline(poly.GetTrimmedOffset(-Width / 2 + Thickness / 2)[0]); dc.DrawPolyline(poly.GetTrimmedOffset(-Width / 2 + -Thickness / 2)[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); } }
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 if (V_true == 0) { double pos_thickness = Thickness < 0 ? Thickness * -1 : Thickness; if (pos_thickness < 3) { V = 16; } else if (pos_thickness == 3) { V = 20; } else if (pos_thickness == 4) { V = 35; } else if (pos_thickness > 4) { V = 50; } } else { V = V_true; } Polyline3d polyround = new Polyline3d(poly); _length_sum = 0; //HostMgd.EditorInput.Editor ed = HostMgd.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; for (int i = 2; i < polyround.Vertices.Count; i += 2) { //double angle1 = Math.Atan2(polyround.Vertices[i - 2].Point.X - polyround.Vertices[i - 1].Point.X, polyround.Vertices[i - 2].Point.Y - polyround.Vertices[i - 1].Point.Y); //double angle2 = Math.Atan2(polyround.Vertices[i - 1].Point.X - polyround.Vertices[i].Point.X, polyround.Vertices[i - 1].Point.Y - polyround.Vertices[i].Point.Y); double anglesum = (polyround.Vertices[i - 1].Point.X - polyround.Vertices[i].Point.X) * (polyround.Vertices[i - 2].Point.Y - polyround.Vertices[i].Point.Y) - (polyround.Vertices[i - 1].Point.Y - polyround.Vertices[i].Point.Y) * (polyround.Vertices[i - 2].Point.X - polyround.Vertices[i].Point.X);//Math.Atan((angle2 - angle1) / (1 + angle2 * angle1));//angle1 + angle2 double a = polyround.Vertices[i - 2].Point.DistanceTo(polyround.Vertices[i - 1].Point); double b = polyround.Vertices[i - 1].Point.DistanceTo(polyround.Vertices[i].Point); double c = polyround.Vertices[i - 2].Point.DistanceTo(polyround.Vertices[i].Point); double angle = Math.Acos((Math.Pow(a, 2) + Math.Pow(b, 2) - Math.Pow(c, 2)) / (2 * a * b)); angle = angle * 180 / Math.PI; double r = V * 0.16; double pos_thickness = Thickness < 0 ? Thickness * -1 : Thickness; double BA = Math.PI / 180 * (180 - angle) * (r + k_factor * pos_thickness); _length_sum += BA; double radius; if (anglesum < 0) { radius = V * 0.16; } else { radius = V * 0.16 + Thickness; } if (Thickness < 0) { radius += Thickness * -1; } polyround.Vertices.MakeFilletAtVertex(i - 1, radius); } for (int i = 0; i < polyround.Vertices.Count; i += 2) { LineSeg3d line = polyround.Segments[i] as LineSeg3d; _length_sum += line.Length; } _length_sum = Math.Round(_length_sum, 4); Polyline3d offset = polyround.GetTrimmedOffset(-Thickness)[0]; dc.DrawPolyline(polyround); dc.DrawPolyline(offset); dc.DrawLine(polyround.Points.FirstPoint, offset.Points.FirstPoint); dc.DrawLine(polyround.Points.LastPoint, offset.Points.LastPoint); Polyline3d middlePoly = polyround.GetTrimmedOffset(-Thickness * (Thickness < 0 ? 1 - k_factor : k_factor))[0]; dc.TextHeight = 2.5 * DbEntity.Scale; //Use annotation scale dc.DrawMText(_textPoint, Vector3d.XAxis, Math.Round(_length_sum, 1).ToString(), HorizTextAlign.Center, VertTextAlign.Center); dc.StrLineType = "Center"; dc.Color = Color.Yellow; dc.LinetypeScale = DbEntity.LinetypeScale * 0.3; dc.DrawPolyline(middlePoly); }