BlockTableRecord btr = new BlockTableRecord();
btr.Name = blkNameж
bt.UpgradeOpen();
Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen();
ObjectId btrId = bt.Add(btr);
tr.AddNewlyCreatedDBObject(btr, true);
DBObjectCollection ents = SquareOfLines(length, height);
foreach (Entity ent in ents)
{
btr.AppendEntity(ent);
tr.AddNewlyCreatedDBObject(ent, true);
}
private DBObjectCollection SquareOfLines(double length, double height)
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
DBObjectCollection ents = new DBObjectCollection();
AttributeDefinition attr_sysname = new AttributeDefinition();
attr_sysname.Tag = "SYSNAME";
attr_sysname.TextString = "SYSNAME";
attr_sysname.Height = 1.8;
attr_sysname.Position = new Point3d(-6, height + 1, 0);
attr_sysname.Constant = true;
attr_sysname.LockPositionInBlock = true;
ents.Add(attr_sysname);
AttributeDefinition attr_manuf = new AttributeDefinition();
attr_manuf.Tag = "MANUFACTURER";
attr_manuf.Height = 1.8;
attr_manuf.Position = new Point3d(- length + 1, height -2, 0);
attr_manuf.TextString = manufacturer;
attr_manuf.Constant = true;
attr_manuf.LockPositionInBlock = true;
ents.Add(attr_manuf);
return ents;
}