Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So, another question for same code i'm working on for dimensioning all intersections of a line.
here's some code:
PromptPointResult ppr = ed.GetPoint("\nSpecify base point: ");
if (ppr.Status != PromptStatus.OK)
return;
Point3d startpunt = ppr.Value;
//startpunt.TransformBy(ed.CurrentUserCoordinateSystem);
PromptPointOptions opt = new PromptPointOptions("\nSpecify second point: ");
opt.UseBasePoint = true;
opt.BasePoint = startpunt;
ppr = ed.GetPoint(opt);
if (ppr.Status != PromptStatus.OK)
return;
Point3d eindpunt = ppr.Value;
//eindpunt.TransformBy(ed.CurrentUserCoordinateSystem);
Extents3d ext = maatlijn.GeometricExtents;
double extminx = ext.MinPoint.X;
double extminy = ext.MinPoint.Y;
double extmaxx = ext.MaxPoint.X;
double extmaxy = ext.MaxPoint.Y;
Point3d extmin = new Point3d(extminx, extminy, 0);
Point3d extmax = new Point3d(extmaxx, extmaxy, 0);
Point3dCollection punten = new Point3dCollection();
//selectionfilter
TypedValue[] filterlijst = new TypedValue[1];
filterlijst[0] = new TypedValue(0, "LINE,POLYLINE,CIRCLE,ARC");
SelectionFilter filter = new SelectionFilter(filterlijst);
//selectionfilter
SelectionSet set = ed.SelectCrossingWindow(extmin, extmax, filter).Value;
foreach (ObjectId id in set.GetObjectIds())
{
Entity ent = tra.GetObject(id, OpenMode.ForRead) as Entity;
maatlijn.IntersectWith(ent, Intersect.OnBothOperands, punten, IntPtr.Zero, IntPtr.Zero);
}
//foreach (Point3d punt in punten)
//{
//punt.TransformBy((ed.CurrentUserCoordinateSystem));
//}
Some time later, I sort the points by X-coordinate.
//sorteren
Point3dCollection punten2 = new Point3dCollection(
punten
.Cast<Point3d>()
.OrderBy(point => point.X)
.ToArray());
//sorteren
It works perfectly fine when UCS is WCS. But when UCS is different, it gives an error here, concerning 'out of range'.
Anyone sees the problem? Should I somehow transform the selectionset? or extents? If yes, then how? Since I see nothing like the 'transformby' here?
Solved! Go to Solution.