- 积分
- 967
- 明经币
- 个
- 注册时间
- 2011-4-13
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
Database db = HostApplicationServices.WorkingDatabase;
Entity acadEntity = null; Entity poleped = null;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
acadEntity = (Entity)trans.GetObject(strandobjectid, OpenMode.ForWrite);
poleped = (Entity)trans.GetObject(PoleObjId, OpenMode.ForWrite);
// if (poleped == null)
// return;
BlockReference br = poleped as BlockReference;
if (acadEntity is Polyline)
{
Polyline strand = acadEntity as Polyline;
Point3dCollection m_ints = new Point3dCollection();
strand.IntersectWith(br, Intersect.OnBothOperands, new Plane(), m_ints, 0, 0);
foreach (Point3d m_pt in m_ints)
{
//br. strand.StartPoint
if (IsStartPoint)
{
strand.AddVertexAt(0, new Point2d(m_pt.X, m_pt.Y), 0, 0, 0);
strand.RemoveVertexAt(1);
}
else
{
int count = strand.NumberOfVertices;
strand.AddVertexAt(count - 1, new Point2d(m_pt.X, m_pt.Y), 0, 0, 0);
strand.RemoveVertexAt(count);
}
break;
}
}
} |
|