<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Break line at intersection while drawing in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/break-line-at-intersection-while-drawing/m-p/10515563#M15611</link>
    <description>&lt;P&gt;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).&amp;nbsp; It then appends new lines based on the intersection points so i can modify them.&amp;nbsp; 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).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine if the jigged line is being drawn up the page.&amp;nbsp; It does not work if the jigged line is being drawn down the page.&amp;nbsp; Its as if the entities returned by:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;jiggedEnts = jiggedLine.GetSplitCurves(jiggedLineIntPoints);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do not follow from start point to intersecting point to intersecting point to end point and jump all over the place.&amp;nbsp; But it only seems to happen when drawing down the page.&amp;nbsp; Is there a way to sort the points or have GetSplitCurves return something more uniform?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phil4GCRJ_0-1627953760007.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/947817iF3C4EDFEBFFE97CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phil4GCRJ_0-1627953760007.png" alt="phil4GCRJ_0-1627953760007.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Drawing Up the Page&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phil4GCRJ_1-1627953801791.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/947818i161ECDA4674F5B28/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phil4GCRJ_1-1627953801791.png" alt="phil4GCRJ_1-1627953801791.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Drawing Down the page&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phil4GCRJ_2-1627953982711.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/947819iF7BD829F3107B9AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phil4GCRJ_2-1627953982711.png" alt="phil4GCRJ_2-1627953982711.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Individual segments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//jiggedLineBreakPoints.Cast&amp;lt;Point3d&amp;gt;().OrderBy(point =&amp;gt; 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();
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Aug 2021 01:30:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-08-03T01:30:34Z</dc:date>
    <item>
      <title>Break line at intersection while drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/break-line-at-intersection-while-drawing/m-p/10515563#M15611</link>
      <description>&lt;P&gt;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).&amp;nbsp; It then appends new lines based on the intersection points so i can modify them.&amp;nbsp; 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).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine if the jigged line is being drawn up the page.&amp;nbsp; It does not work if the jigged line is being drawn down the page.&amp;nbsp; Its as if the entities returned by:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;jiggedEnts = jiggedLine.GetSplitCurves(jiggedLineIntPoints);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do not follow from start point to intersecting point to intersecting point to end point and jump all over the place.&amp;nbsp; But it only seems to happen when drawing down the page.&amp;nbsp; Is there a way to sort the points or have GetSplitCurves return something more uniform?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phil4GCRJ_0-1627953760007.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/947817iF3C4EDFEBFFE97CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phil4GCRJ_0-1627953760007.png" alt="phil4GCRJ_0-1627953760007.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Drawing Up the Page&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phil4GCRJ_1-1627953801791.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/947818i161ECDA4674F5B28/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phil4GCRJ_1-1627953801791.png" alt="phil4GCRJ_1-1627953801791.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Drawing Down the page&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phil4GCRJ_2-1627953982711.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/947819iF7BD829F3107B9AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phil4GCRJ_2-1627953982711.png" alt="phil4GCRJ_2-1627953982711.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Individual segments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//jiggedLineBreakPoints.Cast&amp;lt;Point3d&amp;gt;().OrderBy(point =&amp;gt; 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();
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 01:30:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/break-line-at-intersection-while-drawing/m-p/10515563#M15611</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-03T01:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Break line at intersection while drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/break-line-at-intersection-while-drawing/m-p/10516317#M15612</link>
      <description>&lt;P&gt;i have found a work around for this odd problem. &amp;nbsp;I can use jiggedLine.ReverseCurve() before getting the intersecting points and then reverse it back after editing the line segments.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems to work, at least in testing.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 09:10:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/break-line-at-intersection-while-drawing/m-p/10516317#M15612</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-03T09:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Break line at intersection while drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/break-line-at-intersection-while-drawing/m-p/10518468#M15613</link>
      <description>&lt;P&gt;So the previous workaround i posted still had the odd occasion when GetSplitCurves would not break the jigging line sequentially even if the point collection was sorted and return overlapping line segments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i ended up doing was add the start and end points of the jigged line to the point collection, sort it, redraw the line based on the sorted collection, then carry on as previous without using get split curves&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// sort the points
    jiggedLinePoints.Add(jiggedLine.StartPoint);
    jiggedLinePoints.Add(jiggedLine.EndPoint);
    Point3dCollection jiggedLinePointsSorted = new Point3dCollection(jiggedLinePoints.Cast&amp;lt;Point3d&amp;gt;().OrderBy(point =&amp;gt; point.Y).ToArray());
    DBObjectCollection lineCollection = new DBObjectCollection();


    for (int i = 0; i &amp;lt;= jiggedLinePointsSorted.Count - 2; i++)
    {
        Line line = new Line(jiggedLinePointsSorted[i], jiggedLinePointsSorted[i + 1]);
        line.Linetype = lineType;
        line.ColorIndex = lineColor;
        line.LinetypeScale = lineScale;
        line.Layer = lineNumber;
        lineCollection.Add(line);
    }

    jiggedLinePointsSorted.Remove(jiggedLine.StartPoint);
    jiggedLinePointsSorted.Remove(jiggedLine.EndPoint);

    //jiggedLineEnts = jiggedLine.GetSplitCurves(jiggedLinePoints);

    foreach (DBObject ent in lineCollection)
    {

        Line newLine = ent as Line;
        blockRecord.AppendEntity(newLine);
        transaction.AddNewlyCreatedDBObject(newLine, true);

        foreach (Point3d p in jiggedLinePointsSorted)
        {

            if (newLine.StartPoint == p)
            {
                using (var lineSegment3D = new LineSegment3d(newLine.StartPoint, newLine.EndPoint))
                {
                    var vec = lineSegment3D.Direction.MultiplyBy(cutLen).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(cutLen).Negate();
                    using (var segment3D = new LineSegment3d(lineSegment3D.StartPoint, lineSegment3D.EndPoint.Add(vec)))
                    {
                        newLine.EndPoint = segment3D.EndPoint;
                        newLine.StartPoint = segment3D.StartPoint;
                    }
                }
            }
        }
    ent.Dispose();
    }
    jiggedLine.UpgradeOpen();
    jiggedLine.Erase();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 01:57:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/break-line-at-intersection-while-drawing/m-p/10518468#M15613</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-04T01:57:03Z</dc:date>
    </item>
  </channel>
</rss>

