Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
using (Transaction trans=db.TransactionManager.StartTransaction())
{
BlockTable bt = trans.GetObject(db.BlockTableId,OpenMode.ForRead) as BlockTable ;
BlockTableRecord btr = trans.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForRead) as BlockTableRecord;
foreach (ObjectId id in btr)
{
if (trans.GetObject(id, OpenMode.ForRead) is Line)
{
var line = trans.GetObject(id, OpenMode.ForRead) as Line;
Extents3d geoExt = line.GeometricExtents;
MessageBox.Show(geoExt.MaxPoint.ToString());
}
else if (trans.GetObject(id, OpenMode.ForRead) is A
CAD二次开发——获取线或多段线的信息
最新推荐文章于 2024-04-30 16:02:46 发布