<?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 Re: How to break a curve in a blockreference? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9386447#M20076</link>
    <description>&lt;P&gt;Assuming the user have to specify the break points, why not doing it with native commands as _BEDIT or _REFEDIT ?&lt;/P&gt;</description>
    <pubDate>Thu, 19 Mar 2020 07:09:38 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2020-03-19T07:09:38Z</dc:date>
    <item>
      <title>How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9383977#M20072</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I konw there is a method&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #666666; cursor: text; font-family: 'Artifakt',Tahoma,Helvetica,Arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 27.42px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;GetSplitCurves&lt;/SPAN&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #666666; cursor: text; font-family: 'Artifakt',Tahoma,Helvetica,Arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 27.42px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;DBObjectCollection tmpSplittedCurves = curvLine.GetSplitCurves(pts);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use this can split a curve into several picies curves.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but i do not know how to split curves in a blockreference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 06:09:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9383977#M20072</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2020-03-18T06:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9384198#M20073</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You cannot edit entities in a BlockReference, you can only do it in its BlockTableRecord and the changes will affect all inserted references.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 09:18:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9384198#M20073</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-03-18T09:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9386123#M20074</link>
      <description>&lt;P&gt;Hi Gile,&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;Yes , I had make a mistake.&lt;/P&gt;&lt;P&gt;I wanna edit the blocktablerecord, and it will effect its copies(blockreference).&lt;/P&gt;&lt;P&gt;But, I do not know how to edit a blocktablerecord.&lt;/P&gt;&lt;P&gt;Could you give me some code for spliting a curve into several pieces in a blockrecord?&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 19 Mar 2020 01:10:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9386123#M20074</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2020-03-19T01:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9386129#M20075</link>
      <description>&lt;P&gt;please see the attached pics.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2020 01:13:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9386129#M20075</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2020-03-19T01:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9386447#M20076</link>
      <description>&lt;P&gt;Assuming the user have to specify the break points, why not doing it with native commands as _BEDIT or _REFEDIT ?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2020 07:09:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9386447#M20076</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-03-19T07:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9387021#M20077</link>
      <description>&lt;P&gt;Anyway, here's an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;

using AcAp = Autodesk.AutoCAD.ApplicationServices.Core.Application;

namespace BreakCurveInBlockSample
{
    public class Commands
    {
        [CommandMethod("NESTEDBREAK")]
        public static void BreakCurveInBlock()
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;
            using (var tr = db.TransactionManager.StartTransaction())
            {
                PromptNestedEntityResult pner;
                while (true)
                {
                    pner = ed.GetNestedEntity("\nSelect curve in block: ");
                    if (pner.Status != PromptStatus.OK)
                        return;
                    if (!pner.ObjectId.ObjectClass.IsDerivedFrom(RXObject.GetClass(typeof(Curve))))
                        ed.WriteMessage("\nSelected object is not a curve.");
                    else if (pner.GetContainers().Length == 0)
                        ed.WriteMessage("\nSelected curve is not nested.");
                    else
                        break;
                }
                var curve = (Curve)tr.GetObject(pner.ObjectId, OpenMode.ForWrite);
                var xform = pner.Transform.Inverse() * ed.CurrentUserCoordinateSystem;

                bool tryGetPointonCurve(string message, out Point3d point)
                {
                    var ppr = ed.GetPoint($"\n{message}");
                    if (ppr.Status != PromptStatus.OK)
                    {
                        point = Point3d.Origin;
                        return false;
                    }
                    var pt = ppr.Value.TransformBy(xform);
                    using (var view = ed.GetCurrentView())
                    {
                        point = curve.GetClosestPointTo(pt, view.ViewDirection, false);
                    }
                    return true;
                }

                if (!tryGetPointonCurve("\nSpecify first point: ", out Point3d pt1))
                    return;
                if (!tryGetPointonCurve("\nSpecify second point: ", out Point3d pt2))
                    return;
                if (!tryGetPointonCurve("\nSpecify a point on the part to delete: ", out Point3d pt3))
                    return;
                var points = new Point3dCollection();
                if (curve.GetParameterAtPoint(pt1) &amp;lt; curve.GetParameterAtPoint(pt2))
                {
                    points.Add(pt1);
                    points.Add(pt2);
                }
                else
                {
                    points.Add(pt2);
                    points.Add(pt1);
                }
                var btr = (BlockTableRecord)tr.GetObject(curve.OwnerId, OpenMode.ForWrite);
                var curves = curve.GetSplitCurves(points);
                foreach (Curve c in curves)
                {
                    if (c.GetClosestPointTo(pt3, false).IsEqualTo(pt3))
                    {
                        c.Dispose();
                    }
                    else
                    {
                        btr.AppendEntity(c);
                        tr.AddNewlyCreatedDBObject(c, true);
                    }
                }
                curve.Erase();
                tr.Commit();
            }
            ed.Regen();
        }
    }
}
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 Mar 2020 12:18:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9387021#M20077</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-03-19T12:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388631#M20078</link>
      <description>&lt;P&gt;Hi, Gile:&lt;/P&gt;&lt;P&gt;because this way is more easier for user.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 00:46:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388631#M20078</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2020-03-20T00:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388641#M20079</link>
      <description>&lt;P&gt;Gile:&lt;/P&gt;&lt;P&gt;thank you for your kindly help.&lt;/P&gt;&lt;P&gt;in your code, there are 4 steps,&lt;/P&gt;&lt;P&gt;step 1 is select curve, step 4 is select son curve need be deleted.&lt;/P&gt;&lt;P&gt;is there any way to cancel step 1 through step 4?&lt;/P&gt;&lt;P&gt;because step 4 curve is the same curve before split.&lt;/P&gt;&lt;P&gt;but i do not know how to transform the pt3,&lt;/P&gt;&lt;P&gt;and then use&amp;nbsp;&lt;/P&gt;&lt;P&gt;public Point3d NonInteractivePickPoint { get; set; }&lt;BR /&gt;public bool UseNonInteractivePickPoint { get; set; }&lt;/P&gt;&lt;P&gt;of&amp;nbsp;PromptNestedEntityOptions&lt;/P&gt;&lt;P&gt;to get the nested curve.&lt;/P&gt;&lt;P&gt;please help me, thanks&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 00:59:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388641#M20079</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2020-03-20T00:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388879#M20080</link>
      <description>&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("NESTEDBREAK")]
        public static void BreakCurveInBlock()
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;
            using (var tr = db.TransactionManager.StartTransaction())
            {
                PromptNestedEntityResult pner;
                while (true)
                {
                    pner = ed.GetNestedEntity("\nSelect curve in block (on the part to remove): ");
                    if (pner.Status != PromptStatus.OK)
                        return;
                    if (!pner.ObjectId.ObjectClass.IsDerivedFrom(RXObject.GetClass(typeof(Curve))))
                        ed.WriteMessage("\nSelected object is not a curve.");
                    else if (pner.GetContainers().Length == 0)
                        ed.WriteMessage("\nSelected curve is not nested.");
                    else
                        break;
                }
                var curve = (Curve)tr.GetObject(pner.ObjectId, OpenMode.ForWrite);
                var xform = pner.Transform.Inverse() * ed.CurrentUserCoordinateSystem;
                var pt3 = pner.PickedPoint.TransformBy(xform);
                using (var view = ed.GetCurrentView())
                {
                    pt3 = curve.GetClosestPointTo(pt3, view.ViewDirection, false);
                }

                bool tryGetPointonCurve(string message, out Point3d point)
                {
                    var ppr = ed.GetPoint($"\n{message}");
                    if (ppr.Status != PromptStatus.OK)
                    {
                        point = Point3d.Origin;
                        return false;
                    }
                    var pt = ppr.Value.TransformBy(xform);
                    using (var view = ed.GetCurrentView())
                    {
                        point = curve.GetClosestPointTo(pt, view.ViewDirection, false);
                    }
                    return true;
                }

                if (!tryGetPointonCurve("\nSpecify first point: ", out Point3d pt1))
                    return;
                if (!tryGetPointonCurve("\nSpecify second point: ", out Point3d pt2))
                    return;
                var points = new Point3dCollection();
                if (curve.GetParameterAtPoint(pt1) &amp;lt; curve.GetParameterAtPoint(pt2))
                {
                    points.Add(pt1);
                    points.Add(pt2);
                }
                else
                {
                    points.Add(pt2);
                    points.Add(pt1);
                }
                var btr = (BlockTableRecord)tr.GetObject(curve.OwnerId, OpenMode.ForWrite);
                var curves = curve.GetSplitCurves(points);
                foreach (Curve c in curves)
                {
                    if (c.GetClosestPointTo(pt3, false).IsEqualTo(pt3))
                    {
                        c.Dispose();
                    }
                    else
                    {
                        btr.AppendEntity(c);
                        tr.AddNewlyCreatedDBObject(c, true);
                    }
                }
                curve.Erase();
                tr.Commit();
            }
            ed.Regen();
        }&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class="" title=""&gt;I find it strange that you have so many blocks to modify this way, so much that you need a program.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 06:13:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388879#M20080</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-03-20T06:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388893#M20081</link>
      <description>&lt;P&gt;Hi, Gile:&lt;/P&gt;&lt;P&gt;Many users are not familiar with editing a block reference.&lt;/P&gt;&lt;P&gt;Especially the block with attributes.&lt;/P&gt;&lt;P&gt;In this case, they usually try to break up the block references.&lt;/P&gt;&lt;P&gt;And that's not what I want, because there's a lot of XDATA in the block.&lt;/P&gt;&lt;P&gt;That's why I need a program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you tell me how to select the curve in blockreference by pt3 selently.&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 06:26:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388893#M20081</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2020-03-20T06:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388901#M20082</link>
      <description>&lt;P&gt;In my last attempt, the pt3 is got from the curve selection (PickedPoint) and it is the simplest way to get it. So there're only 3 inputs.&lt;/P&gt;
&lt;P&gt;If you absolutely need to do it in the reverse way (pick a point and get the entity with NonInteractivePickPoint), you need to set the NonInteractivePickPoint with pt3, and check the result of PromptNestedEntityResult.&lt;/P&gt;
&lt;P&gt;I have no time to this right now, but you should be able to do it by yourself.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 06:38:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9388901#M20082</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-03-20T06:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to break a curve in a blockreference?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9390866#M20083</link>
      <description>&lt;P&gt;Hi,Gile:&lt;/P&gt;&lt;P&gt;I Had finished the program,&lt;/P&gt;&lt;P&gt;and known how to edit a entity in a blocktablerecord.&lt;/P&gt;&lt;P&gt;Thanks so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Mar 2020 07:51:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-break-a-curve-in-a-blockreference/m-p/9390866#M20083</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2020-03-21T07:51:34Z</dc:date>
    </item>
  </channel>
</rss>

