public List <AcadDB.Entity> Draw() { List <AcadDB.Entity> ents = new List <AcadDB.Entity>(); if (0 == steel_pos.Count) { return(ents); } AcadGeo.Point3d tmp_line = steel_pos[0]; foreach (var sp in steel_pos) { AcadDB.Line line = new AcadDB.Line(); line.StartPoint = sp + length_line * AcadGeo.Vector3d.XAxis + length_line * AcadGeo.Vector3d.YAxis; line.EndPoint = sp - length_line * AcadGeo.Vector3d.XAxis - length_line * AcadGeo.Vector3d.YAxis; ents.Add(line); if (position.DistanceTo(sp) > position.DistanceTo(tmp_line)) { tmp_line = sp; } } ents.Add(new AcadDB.Line(position, tmp_line)); ents.Add(new AcadDB.Circle(position - AcadGeo.Vector3d.XAxis * cir_radius, AcadGeo.Vector3d.ZAxis, cir_radius)); //Draw number { AcadDB.DBText text = new AcadDB.DBText(); text.TextString = number.ToString(); text.Justify = AcadDB.AttachmentPoint.MiddleCenter; text.Height = text_height; text.WidthFactor = text_w_factor; text.AlignmentPoint = position - AcadGeo.Vector3d.XAxis * cir_radius; ents.Add(text); } //draw content { AcadDB.DBText text = new AcadDB.DBText(); text.TextString = content; text.Justify = AcadDB.AttachmentPoint.BottomLeft; text.Height = text_height; text.WidthFactor = text_w_factor; text.AlignmentPoint = position + AcadGeo.Vector3d.XAxis * 10.0 + AcadGeo.Vector3d.YAxis * 10.0; ents.Add(text); } return(ents); }
public List <AcadDB.Entity> Draw() { AcadGeo.Line3d xline = new AcadGeo.Line3d(position, AcadGeo.Vector3d.XAxis); List <AcadDB.Entity> ents = new List <AcadDB.Entity>(); AcadGeo.Point3d pnt = new AcadGeo.Point3d(position.X, position.Y, position.Z); foreach (var sp in steel_pos) { AcadGeo.Line3d steel_line = new AcadGeo.Line3d(sp, new AcadGeo.Vector3d(Math.Sin(angle), Math.Cos(angle), 0.0)); AcadGeo.Point3d[] intersected_pnts = xline.IntersectWith(steel_line); if (intersected_pnts.Length > 0) { ents.Add(new AcadDB.Line(intersected_pnts[0], sp)); if (intersected_pnts[0].DistanceTo(position) > pnt.DistanceTo(position)) { pnt = intersected_pnts[0]; } } } ents.Add(new AcadDB.Line(position, pnt)); ents.Add(new AcadDB.Circle(position - AcadGeo.Vector3d.XAxis * cir_radius, AcadGeo.Vector3d.ZAxis, cir_radius)); //draw value { AcadDB.DBText text = new AcadDB.DBText(); text.TextString = number.ToString(); text.Justify = AcadDB.AttachmentPoint.MiddleCenter; text.Height = text_height; text.WidthFactor = text_w_factor; text.AlignmentPoint = position - AcadGeo.Vector3d.XAxis * cir_radius; ents.Add(text); } //draw content { AcadDB.DBText text = new AcadDB.DBText(); text.TextString = content; text.Justify = AcadDB.AttachmentPoint.BottomLeft; text.Height = text_height; text.WidthFactor = text_w_factor; text.AlignmentPoint = position + AcadGeo.Vector3d.XAxis * 10.0 + AcadGeo.Vector3d.YAxis * 10.0; ents.Add(text); } return(ents); }
private double GetSpacing() { return(start_point.DistanceTo(end_point) / (number_steel - 1)); }
private Solid.Profile CalculateProfile(AcadGeo.Point3d pnt) { Solid.Profile ret_prol = new Solid.Profile(profile); Node sn = FindNode(ret_prol.BasePoint); Node dn = FindNode(pnt); if (sn == dn) { return(ret_prol); } if (null == sn || null == dn) { return(null); } IEnumerable <Connection> routes = null; TryFunc <Node, IEnumerable <Connection> > func = routers.ShortestPathsDijkstra(e => 1, sn); if (func(dn, out routes)) { if (null == routes || 0 == routes.Count()) { return(null); } List <AcadGeo.Point3d> route_pnts = new List <AcadGeo.Point3d>(); route_pnts.Add(sn.Position); for (int i = 0; i < routes.Count(); i++) { if (routes.ElementAt(i).Source.Position.IsEqualTo(route_pnts.Last())) { route_pnts.Add(routes.ElementAt(i).Target.Position); } else { route_pnts.Add(routes.ElementAt(i).Source.Position); } } if (route_pnts.Count > 1) { ret_prol.Rotate(AcadFuncs.GetVec(route_pnts[0], route_pnts[1])); } for (int i = 0; i < route_pnts.Count() - 1; i++) { AcadGeo.Point3d sc = route_pnts.ElementAt(i); AcadGeo.Point3d dc = route_pnts.ElementAt(i + 1); ret_prol.Translate(AcadFuncs.GetVec(dc, sc) * sc.DistanceTo(dc)); if (i > 0) { ret_prol.Rotate(ret_prol.BasePoint.IsEqualTo(dc) ? AcadFuncs.GetVec(dc, sc) : AcadFuncs.GetVec(sc, dc)); } } return(ret_prol); } return(null); }