- 积分
- 394
- 明经币
- 个
- 注册时间
- 2011-1-11
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
我想放大整个图形10倍,程序代码如下,但总有问题,请高手帮忙看看吧!
public static void seAll(Point3d pt)
{
Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
Editor ed = acDoc.Editor;
Entity entity = null;
DBObjectCollection EntityCollection = new DBObjectCollection();
PromptSelectionResult ents = ed.SelectAll();
if (ents.Status == PromptStatus.OK)
{
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
SelectionSet ss = ents.Value;
foreach (ObjectId id in ss.GetObjectIds())
{
entity = acTrans.GetObject(id, OpenMode.ForWrite, true) as Entity;
if (entity != null)
{
entity.TransformBy(Matrix3d.Scaling(10, pt));
acBlkTblRec.AppendEntity(entity);
acTrans.AddNewlyCreatedDBObject(entity, true);
}
}
acTrans.Commit();
}
}
else
{
ed.WriteMessage("全部图元选择失败");
}
}
总提示 acBlkTblRec.AppendEntity(entity);有问题,不知是什么原因
|
|