在AutoCAD官方的开发文档里是这样写的,用VBA方法来修改属性的值。Change the value of the attribute
' Note: There is no SetAttributes. Once you have the variant array, you have the objects.
' Changing them changes the objects in the drawing. varAttributes(0).TextString = "NEW VALUE!"
但是我用C#通过com方式时,在visiostudio里, 我尝试用varAttributes.TextString,但是发现没有这个方法,请教一下,是我少引用了库,还是什么原因?
Acadapp.Visible = true; foreach (AcadEntity item in AcadDoc.ModelSpace) { if (item is AcadBlockReference blockReference) { MessageBox.Show(blockReference.EntityName); // 块的所有属性列表 object[] varAttributes = blockReference.GetAttributes(); for (int i = 0; i < varAttributes.Length; i++) { //if (varAttributes.TextString == oldMachineName) //{ // varAttributes.TextString = newMachineName; //}