我无法更改 acadblock 的颜色。但我可以改变线条和弧线等的颜色。但是当我尝试改变块颜色时它不会改变。任何机构都可以告诉我该怎么做吗?
在这里我提到了我的代码:
AcadApplication acadApp;
AcadDocument curDoc;
AcadSelectionSet selset;
AcadLine lin;
AcadBlockReference blkRef;
short[] ftype = new short[1];
object[] fdata = new object[1];
ftype[0] = 0;
fdata[0] = "Line,INSERT";
acadApp = (AcadApplication)Marshal.GetActiveObject("Autocad.Application.18");
curDoc = acadApp.ActiveDocument;
selset = curDoc.SelectionSets.Add("Selset2");
selset.Select(AcSelect.acSelectionSetAll, null, null, ftype, fdata);
foreach (AcadEntity item in selset)
{
if (item.ObjectName == "AcDbLine")
{
item.color = ACAD_COLOR.acYellow; //here working fine
}
else if (item.ObjectName == "AcDbBlockReference")
{
item.color = ACAD_COLOR.acMagenta; //here does not working
}
}
selset.Delete();
提前致谢..