procedure TForm1.Button1Click(Sender: TObject);
var Acad, AcadDoc, Blk, pt, Attr: OLEVariant;
ObjBlk: IDispatch;
str: string;
i: integer;
begin
try
Acad := GetActiveOLEObject('AutoCAD.Application');
AcadDoc := Acad.ActiveDocument;
Acad.Visible := True;
AcadDoc.Utility.GetEntity(ObjBlk, pt, 'Выбери блок:');
blk := ObjBlk;
str := blk.ObjectName;
attr:= blk.GetAttributes;
for i := 0 to VarArrayHighBound(attr,1) do begin
str := attr[i].TagString;
// MessageDlg('Tag = ' + str, mtWarning, [mbOk], 0);
if str = 'NAME' then attr[i].TextString := 'Aleksei';
end;
except
// обработка ошибок
end;
end;