<?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: Spline Length in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3930740#M49480</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; Try calling it on an Arc whose start angle is != 0.0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Well, tried, my result is 0.0 as you can see in the screenshot (that shows the debug-info from an arc with start-angle and end-angle != 0.0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2013 19:32:32 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2013-05-21T19:32:32Z</dc:date>
    <item>
      <title>Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929666#M49474</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is there a way to determine the length of a spline?&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2013 22:04:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929666#M49474</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2013-05-20T22:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929700#M49475</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look here:&amp;nbsp;&lt;A target="_self" href="http://spiderinnet1.typepad.com/blog/2012/10/autocad-net-is-bulletproof-code-that-bad.html"&gt;Curve Length&lt;/A&gt;&amp;nbsp;, and also here:&amp;nbsp;&lt;A target="_self" href="http://otb.manusoft.com/2013/01/quirkypolyline-exposing-foolish-programmers.htm"&gt;Quirky Polylines&lt;/A&gt;&amp;nbsp;for more enlightenment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2013 23:03:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929700#M49475</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2013-05-20T23:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929717#M49476</link>
      <description>&lt;P&gt;Hi Gasty, the code at the first link you referenced is not terribly robust. It will fail on curves that have no length (e.g., Rays and XLines), and assumes that the caller is passing the result of the 'as' operator to cast the object to a Curve, but not retaining the reference to the Curve (or having to do that again), and it doesn't leverage extension methods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; line-height: 14px;"&gt;This extension method will return a bool to indicate if the a length was acquired, or false if not, and will set the result parameter to the curve's length. &amp;nbsp;You can use this method on any Curve without it throwing an exception, but you should still filter those types that consistently do not produce a result (like Rays and XLines), to avoid the higher cost of having to catch many thrown exceptions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public static class CurveExtensions
{
   public static bool TryGetLength( this Curve curve, out double result )
   {
      try
      {
         result = curve.GetDistanceAtParameter( curve.EndParam ) -
            curve.GetDistanceAtParameter( curve.StartParam );
         return true;
      }
      catch( Autodesk.AutoCAD.Runtime.Exception )
      {
         result = 0.0;
         return false;
      }
   }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2013 23:47:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929717#M49476</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2013-05-20T23:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929728#M49477</link>
      <description>&lt;P&gt;Hi Tony,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are right, just had the link to spiderman in my references without checking. Nice way to go with that Tony.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2013 00:34:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3929728#M49477</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2013-05-21T00:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3930663#M49478</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; curve.GetDistanceAtParameter( curve.StartParam )&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;May I ask what condition has to exist that this calculation will result in a value n.e. 0.0?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2013 18:13:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3930663#M49478</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2013-05-21T18:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3930719#M49479</link>
      <description>&lt;P&gt;Try calling it on an Arc whose start angle is != 0.0&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2013 19:09:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3930719#M49479</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2013-05-21T19:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3930740#M49480</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; Try calling it on an Arc whose start angle is != 0.0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Well, tried, my result is 0.0 as you can see in the screenshot (that shows the debug-info from an arc with start-angle and end-angle != 0.0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2013 19:32:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3930740#M49480</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2013-05-21T19:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3931007#M49481</link>
      <description>&lt;P&gt;It is the StartParameter that is not always 0.0. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result of GetDistanceAtParameter() with the curve's start parameter is usually 0.0, but I have seen cases where it isn't, which involved custom objects derived from AcDbCurve, that return a non-zero value, and getting the actual length requires the algorithm shown, so it is designed to ensure that the actual distance is calculated, even if the distance at the start parameter is non-zero, which is an assumption I don't recommend relying on if dealing with custom objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2013 02:06:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3931007#M49481</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2013-05-22T02:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3931015#M49482</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; The result of GetDistanceAtParameter() with the curve's start parameter is usually 0.0&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;That was my question, when this result gives != 0.0.&lt;/P&gt;&lt;P&gt;So the arc you suggested does return 0.0 for you too?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; but I have seen cases where it isn't, which involved custom objects derived from AcDbCurve&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In that case the custom objects returns a wrong value. And if it returns a defect length at the startparam I also would not trust any other calculation returned by GetDistanceAtParameter(), so also for the endparam. With other words the length calculation in that case might be wrong anyway and not to be trusted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At least I never have seen that this return not 0.0 and so I'm wondering about that calculation within your function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2013 02:45:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3931015#M49482</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2013-05-22T02:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Spline Length</title>
      <link>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3931021#M49483</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/389680"&gt;@Alfred.NESWADBA&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; The result of GetDistanceAtParameter() with the curve's start parameter is usually 0.0&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;That was my question, when this result gives != 0.0.&lt;/P&gt;&lt;P&gt;So the arc you suggested does return 0.0 for you too?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No, actually I mistakenly thought you were asking about the value of the StartParameter, which is non-zero for arcs and some other objects.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2013 03:00:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/spline-length/m-p/3931021#M49483</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2013-05-22T03:00:55Z</dc:date>
    </item>
  </channel>
</rss>

