设置透明度的方法2.
核心代码同上文。
public bool SetDiaphaneity(double Mdiaphaneity, ObjectId[] EntityId)
{
bool setBool = false;
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
using (DocumentLock docLock = Application.DocumentManager.MdiActiveDocument.LockDocument())
{
using (Database db = HostApplicationServices.WorkingDatabase)
{
try
{
using (Transaction trans = db.TransactionManager.StartTransaction())
{
AddMaterial(Mdiaphaneity, "wood");
foreach (ObjectId obi in EntityId)
{
Entity ent = trans.GetObject(obi, OpenMode.ForWrite) as Entity;
ent.Material = "wood";
this.Dispose(ent);
}
trans.Commit();
setBool = true;
}
}
finally
{
this.Dispose(db);
}
}
}
return setBool;
}
如有问题请联系:qq1419226548