public TPolygons getConfig() { XmlSerializer ser = new XmlSerializer(typeof(TPolygons)); TPolygons config = new TPolygons(); using (XmlTextReader reader = new XmlTextReader(@"D:\config.xml")) //using (TextReader tr = new StringReader()) { config = (TPolygons)ser.Deserialize(reader); } return(config); }
public void CreateBlock() { Database db = HostApplicationServices.WorkingDatabase; BlockTableRecord btr = new BlockTableRecord(); btr.Name = "Random";// +DateTime.Now.ToString(); TPolygons config = getConfig(); foreach (Polygon node in config.Polygons) { List <Point2d> pts = new List <Point2d>(); foreach (Point pt in node.Points) { pts.Add(new Point2d(pt.X, pt.Y)); } Polyline poly = getPolyline(pts); btr.AppendEntity(poly); } AddBlockTableRecord(btr, db); }