<?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 Screen update become slow when using GetSplitCurve() with DBObject.HangOverTo() in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/screen-update-become-slow-when-using-getsplitcurve-with-dbobject/m-p/11890139#M9220</link>
    <description>&lt;P&gt;Good evening everyone. I have a question.&lt;/P&gt;&lt;P&gt;I have below code to split an original curve into 2 new curves then hangover 1 of them with original curve.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Point3dCollection splitPnts = new Point3dCollection();
                splitPnts.Add(trimPnt);

                using (DBObjectCollection splitCurvs = memCurv.GetSplitCurves(splitPnts))
                {
                    //baseEd.WriteMessage($"\nSplit curves 's number : {splitCurvs.Count}");
                    //baseEd.WriteMessage($"\nSplit curves 's point : X = {splitPnts[0].X} , Y = {splitPnts[0].Y}");

                    //Find closet points  :
                    Point3d cloPnt1 = ((Curve)splitCurvs[0]).GetClosestPointTo(stdPnt, false);
                    Point3d cloPnt2 = ((Curve)splitCurvs[1]).GetClosestPointTo(stdPnt, false);

                    if (cloPnt1.DistanceTo(trimPnt) &amp;lt;= KRTolerance)
                        memCurv.HandOverTo(splitCurvs[1], true, true);
                    else
                        memCurv.HandOverTo(splitCurvs[0], true, true);

                }&lt;/LI-CODE&gt;&lt;P&gt;The problem is after the command is finish , the original curve is still the same and&amp;nbsp;i have to drag my mouse about 1～2 seconds for screen update .&lt;/P&gt;&lt;P&gt;I tried to use&amp;nbsp;Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();&lt;/P&gt;&lt;P&gt;But it didn't work . Please help .&lt;/P&gt;&lt;P&gt;Thanks in advance !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 10:27:20 GMT</pubDate>
    <dc:creator>trithuongle</dc:creator>
    <dc:date>2023-04-12T10:27:20Z</dc:date>
    <item>
      <title>Screen update become slow when using GetSplitCurve() with DBObject.HangOverTo()</title>
      <link>https://forums.autodesk.com/t5/net-forum/screen-update-become-slow-when-using-getsplitcurve-with-dbobject/m-p/11890139#M9220</link>
      <description>&lt;P&gt;Good evening everyone. I have a question.&lt;/P&gt;&lt;P&gt;I have below code to split an original curve into 2 new curves then hangover 1 of them with original curve.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Point3dCollection splitPnts = new Point3dCollection();
                splitPnts.Add(trimPnt);

                using (DBObjectCollection splitCurvs = memCurv.GetSplitCurves(splitPnts))
                {
                    //baseEd.WriteMessage($"\nSplit curves 's number : {splitCurvs.Count}");
                    //baseEd.WriteMessage($"\nSplit curves 's point : X = {splitPnts[0].X} , Y = {splitPnts[0].Y}");

                    //Find closet points  :
                    Point3d cloPnt1 = ((Curve)splitCurvs[0]).GetClosestPointTo(stdPnt, false);
                    Point3d cloPnt2 = ((Curve)splitCurvs[1]).GetClosestPointTo(stdPnt, false);

                    if (cloPnt1.DistanceTo(trimPnt) &amp;lt;= KRTolerance)
                        memCurv.HandOverTo(splitCurvs[1], true, true);
                    else
                        memCurv.HandOverTo(splitCurvs[0], true, true);

                }&lt;/LI-CODE&gt;&lt;P&gt;The problem is after the command is finish , the original curve is still the same and&amp;nbsp;i have to drag my mouse about 1～2 seconds for screen update .&lt;/P&gt;&lt;P&gt;I tried to use&amp;nbsp;Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();&lt;/P&gt;&lt;P&gt;But it didn't work . Please help .&lt;/P&gt;&lt;P&gt;Thanks in advance !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 10:27:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/screen-update-become-slow-when-using-getsplitcurve-with-dbobject/m-p/11890139#M9220</guid>
      <dc:creator>trithuongle</dc:creator>
      <dc:date>2023-04-12T10:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Screen update become slow when using GetSplitCurve() with DBObject.HangOverTo()</title>
      <link>https://forums.autodesk.com/t5/net-forum/screen-update-become-slow-when-using-getsplitcurve-with-dbobject/m-p/11891458#M9221</link>
      <description>&lt;P&gt;Is it possible to see your code in its entirety?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 19:05:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/screen-update-become-slow-when-using-getsplitcurve-with-dbobject/m-p/11891458#M9221</guid>
      <dc:creator>hippe013</dc:creator>
      <dc:date>2023-04-12T19:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Screen update become slow when using GetSplitCurve() with DBObject.HangOverTo()</title>
      <link>https://forums.autodesk.com/t5/net-forum/screen-update-become-slow-when-using-getsplitcurve-with-dbobject/m-p/11897673#M9222</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1633394"&gt;@hippe013&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi , It is ok . I sent it as below .&lt;/P&gt;&lt;P&gt;Now ,&amp;nbsp; i also put my alternative way to achieve this , but actually i want to finish in the old way with screen update not become slow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        void CmdTE_TrimCurves(Editor baseEd, Transaction baseTr,
                              Curve boCurv, Curve memCurv,
                              Point3dCollection intPnts, Point3d stdPnt)
        {
            //Variable for trim point :
            Point3d trimPnt;

            //Upgrate member curve to 'OpenForWrite'
            memCurv.UpgradeOpen();

            trimPnt = intPnts[0];

            //Find point to trim :
            if (intPnts.Count &amp;gt; 1)
            {
                for (int i = 1; i &amp;lt; intPnts.Count; i++)
                {
                    if (stdPnt.DistanceTo(intPnts[i]) &amp;lt;
                        stdPnt.DistanceTo(trimPnt))
                        trimPnt = intPnts[i];
                }
            }

            #region [Trim curve]
            try
            {
                Point3dCollection splitPnts = new Point3dCollection() { trimPnt };

                using (DBObjectCollection splitCurvs = memCurv.GetSplitCurves(splitPnts))
                {
                    //Find closet points  :
                    Point3d cloPnt = ((Curve)splitCurvs[0]).GetClosestPointTo(stdPnt, false);

                    #region [codes part that seem to make process became slow]
                    ////Trim curve :
                    //if (cloPnt.DistanceTo(trimPnt) &amp;lt;= KRTolerance)
                    //    memCurv.HandOverTo(splitCurvs[1], true, true);
                    //else
                    //    memCurv.HandOverTo(splitCurvs[0], true, true);
                    #endregion

		    #region [My alternative solution for now]
                    Curve retCurv;
                    if (cloPnt.DistanceTo(trimPnt) &amp;lt;= KRTolerance)
                        retCurv = (Curve)splitCurvs[1];
                    else
                        retCurv = (Curve)splitCurvs[0];

                    ObjectId retId;
                    using (Transaction tr = db().TransactionManager.StartTransaction())
                    {
                        retId = AppendEnt(tr, retCurv);
                        tr.Commit();
                    }

                    memCurv.SwapIdWith(retId, true, true);
                    memCurv.Erase();
  		    #endregion
                }
            }

            catch (System.Exception ex)
            {
		ed.WriteMessage($"\nError : {ex.Message}");
                return;
            }
            
            #endregion
        }&lt;/LI-CODE&gt;&lt;P&gt;Thanks in advance !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Apr 2023 00:25:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/screen-update-become-slow-when-using-getsplitcurve-with-dbobject/m-p/11897673#M9222</guid>
      <dc:creator>trithuongle</dc:creator>
      <dc:date>2023-04-15T00:25:14Z</dc:date>
    </item>
  </channel>
</rss>

