- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i have a line jig that returns the intersecting points of the newly created line (jiggedLine) and any existing lines it crosses into a Point3dCollection (jiggedLineIntPoints). It then appends new lines based on the intersection points so i can modify them. In this case i want to shorten the start or end point of the newly entrapped line if it sits on one of the intersection points in (jiggedLineIntPoints).
This works fine if the jigged line is being drawn up the page. It does not work if the jigged line is being drawn down the page. Its as if the entities returned by:
jiggedEnts = jiggedLine.GetSplitCurves(jiggedLineIntPoints);
do not follow from start point to intersecting point to intersecting point to end point and jump all over the place. But it only seems to happen when drawing down the page. Is there a way to sort the points or have GetSplitCurves return something more uniform?
Drawing Up the Page
Drawing Down the page
Individual segments
//jiggedLineBreakPoints.Cast<Point3d>().OrderBy(point => point.Y);
jiggedEnts = jiggedLine.GetSplitCurves(jiggedLineIntPoints);
foreach (DBObject ent in jiggedEnts)
{
blockRecord.AppendEntity(ent as Entity);
transaction.AddNewlyCreatedDBObject(ent, true);
Line newLine = ent as Line;
foreach (Point3d p in jiggedLineIntPoints)
{
if (newLine.StartPoint == p)
{
using (var lineSegment3D = new LineSegment3d(newLine.StartPoint, newLine.EndPoint))
{
var vec = lineSegment3D.Direction.MultiplyBy(2).Negate();
using (var segment3D = new LineSegment3d(lineSegment3D.StartPoint.Subtract(vec), lineSegment3D.EndPoint))
{
newLine.EndPoint = segment3D.EndPoint;
newLine.StartPoint = segment3D.StartPoint;
}
}
}
if (newLine.EndPoint == p)
{
using (var lineSegment3D = new LineSegment3d(newLine.StartPoint, newLine.EndPoint))
{
var vec = lineSegment3D.Direction.MultiplyBy(2).Negate();
using (var segment3D = new LineSegment3d(lineSegment3D.StartPoint, lineSegment3D.EndPoint.Add(vec)))
{
newLine.EndPoint = segment3D.EndPoint;
newLine.StartPoint = segment3D.StartPoint;
}
}
}
}
ent.Dispose();
}
if (countLines == psr.Value.Count)
{
jiggedLine.UpgradeOpen();
jiggedLine.Erase();
}
Solved! Go to Solution.