cad.net创建wipeout仅支持2008及以后版本
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
namespace WipeoutApplication
{
public class Commands
{
[CommandMethod("CW")]
public void CreateWipeout()
{
Document doc =
Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Transaction tr =
db.TransactionManager.StartTransaction();
using (tr)
{
BlockTable bt =
(BlockTable)tr.GetObject(
db.BlockTableId,
OpenMode.ForRead,
false
);
BlockTableRecord btr =
(BlockTableRecord)tr.GetObject(
bt[BlockTableRecord.ModelSpace],
OpenMode.ForWrite,
false
);
Point2dCollection pts =
new Point2dCollection(5);
pts.Add(new Point2d(0.0, 0.0));
pts.Add(new Point2d(100.0, 0.0));
pts.Add(new Point2d(100.0, 100.0));
pts.Add(new Point2d(0.0, 100.0));
pts.Add(new Point2d(0.0, 0.0));
Wipeout wo = new Wipeout();
wo.SetDatabaseDefaults(db);
wo.SetFrom(pts, new Vector3d(0.0, 0.0, 0.1));
btr.AppendEntity(wo);
tr.AddNewlyCreatedDBObject(wo, true);
tr.Commit();
}
}
}
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。