- 积分
- 1052
- 明经币
- 个
- 注册时间
- 2010-9-25
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2011-3-21 08:19:49
|
显示全部楼层
pt = new Point3d(0, 0, ptz);
plan = new Plane(pt, Vector3d.ZAxis);//画一个高程为ptz的面
pl = firstRgn(plan);//面转为多段线
public Polyline firstRgn(Plane plan)
{
Polyline poly = new Polyline();
Region reg = sd.GetSection(plan);//sd三维实体。用面plan切sd
DBObjectCollection dbpolys = PolylineFromRegion(reg);
Polyline littlePoly = dbpolys[0] as Polyline;//小短线
Point2d sp = new Point2d(littlePoly.StartPoint.X, littlePoly.StartPoint.Y);
Point2d ep = new Point2d(littlePoly.EndPoint.X, littlePoly.EndPoint.Y);
poly.AddVertexAt(poly.NumberOfVertices, sp, 0, 0, 0);
poly.AddVertexAt(poly.NumberOfVertices, ep, 0, 0, 0);
dbpolys.Remove(littlePoly);
int polyCount = dbpolys.Count;
Point2d nextPt = new Point2d();
for (int pi = 0; pi < polyCount; pi++)
{
foreach (Polyline dbpoly in dbpolys)
{
if (PointDistance(poly.EndPoint, dbpoly.StartPoint) < 0.1)
{
nextPt = new Point2d(dbpoly.EndPoint.X, dbpoly.EndPoint.Y);
dbpolys.Remove(dbpoly);
poly.AddVertexAt(poly.NumberOfVertices, nextPt, 0, 0, 0);
break;
}
if (PointDistance(poly.EndPoint, dbpoly.EndPoint) < 0.1)
{
nextPt = new Point2d(dbpoly.StartPoint.X, dbpoly.StartPoint.Y);
dbpolys.Remove(dbpoly);
poly.AddVertexAt(poly.NumberOfVertices, nextPt, 0, 0, 0);
break;
}
}
}
poly.Closed = true;
//jinhe.ObjectARX.Tools.AddEntity(poly);
return poly;
}
具体不知道哪里错的???? |
|