<?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 AcDbSpline constructor problem in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7507871#M7480</link>
    <description>&lt;P&gt;Dear colleagues,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a problem wit AcDbSpline constructor, it always behaves like default constructor. I try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AcDbSpline *tmp = new AcDbSpline(ptAry, kChord);
or
AcDbSpline *tmp = new AcDbSpline(ptAry);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but nothing, it is always default constructor. I create points array like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AcGePoint3dArray ptAry(6);
for (int n = 0; n &amp;lt; 6; n++)
{
double x = 0, y = 0;
x = ...;
y = ...;
ptAry[n].set(x, y, 0);
}&lt;/PRE&gt;
&lt;P&gt;And it seems OK because later I can draw AcDbLine using the points from the ptAry.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Nov 2017 13:05:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-01T13:05:19Z</dc:date>
    <item>
      <title>AcDbSpline constructor problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7507871#M7480</link>
      <description>&lt;P&gt;Dear colleagues,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a problem wit AcDbSpline constructor, it always behaves like default constructor. I try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AcDbSpline *tmp = new AcDbSpline(ptAry, kChord);
or
AcDbSpline *tmp = new AcDbSpline(ptAry);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but nothing, it is always default constructor. I create points array like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AcGePoint3dArray ptAry(6);
for (int n = 0; n &amp;lt; 6; n++)
{
double x = 0, y = 0;
x = ...;
y = ...;
ptAry[n].set(x, y, 0);
}&lt;/PRE&gt;
&lt;P&gt;And it seems OK because later I can draw AcDbLine using the points from the ptAry.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 13:05:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7507871#M7480</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T13:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbSpline constructor problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7510597#M7481</link>
      <description>&lt;P&gt;If this is actually your code, than your array initialization is wrong!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AcGePoint3dArray ptAry(6);
for (int n = 0; n &amp;lt; 6; n++)
	ptAry[n].set(x, y, 0);
&lt;/PRE&gt;
&lt;P&gt;The first line constructs an array with a &lt;EM&gt;physical&lt;/EM&gt;&amp;nbsp; length of 6 elements. But it still has a &lt;EM&gt;logical&lt;/EM&gt;&amp;nbsp; length of 0!&lt;/P&gt;
&lt;P&gt;In other words: &lt;FONT face="courier new,courier"&gt;ptAry.length()=0&lt;/FONT&gt;. So you are calling the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;AcDbSpline()&lt;/FONT&gt; constructor with an empty array of points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See acarray.h:&lt;/P&gt;
&lt;PRE&gt;AcArray&amp;lt; T, R &amp;gt; ::AcArray(int physicalLength, int growLength)
: mpArray(nullptr),
  mPhysicalLen(physicalLength),
  mLogicalLen(0),    &amp;lt;-------------------- !!
  mGrowLen(growLength)  [...}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;FONT face="courier new,courier"&gt;ptAry.setLogicalLength(6)&lt;/FONT&gt; before the &lt;FONT face="courier new,courier"&gt;for&lt;/FONT&gt;-loop to fix this.&lt;/P&gt;
&lt;P&gt;Or use &lt;FONT face="courier new,courier"&gt;p&lt;/FONT&gt;tAry.&lt;FONT face="courier new,courier"&gt;append(pt)&lt;/FONT&gt; instead of. These methods will increment the logical length for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case your &lt;FONT face="courier new,courier"&gt;ptAry&lt;/FONT&gt; is ok:&lt;/P&gt;
&lt;P&gt;The ARX docs for the &lt;FONT face="courier new,courier"&gt;AcDbSpline()&lt;/FONT&gt; constructors say:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If any of the parameters are not acceptable, then the gelib object for the spline is not created and this constructor &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; behaves like the default constructor (that is, the passed in values are not used and the data query methods on the &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; spline return invalid values).&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The constructors you are using are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    AcDbSpline(const AcGePoint3dArray&amp;amp; fitPoints,
               int                     order = 4,  //order=degree+1
               double                  fitTolerance = 0.0);
			   
    AcDbSpline(const AcGePoint3dArray&amp;amp; fitPoints,
               AcGe::KnotParameterization    knotParam,
               int                     degree = 3, //order=degree+1
               double                  fitTolerance = 0.0);
&lt;/PRE&gt;
&lt;P&gt;The first one is deprecated according to the ARX 2018 docs. You shouldn't use it anymore. the second one should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest to use the default constructor and &lt;FONT face="courier new,courier"&gt;setFitData(...) / setNurbsData(...)&lt;/FONT&gt; methods and look at their retured &lt;FONT face="courier new,courier"&gt;ErrorStatus&lt;/FONT&gt; to find out what is going wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 09:07:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7510597#M7481</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2017-11-02T09:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbSpline constructor problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7512245#M7482</link>
      <description>&lt;P&gt;Thanks for suggestions. I will try them tomorrow at work and let you know about results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Regarding array initialization:&lt;/P&gt;
&lt;P&gt;What confuses me is that I can use array initialized and filled in this way to draw AcDbLines. I will set logical length explicitly to 6 at the beginning and try that way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Regarding AcDbSpline constructors:&lt;/P&gt;
&lt;P&gt;We should use the second one you mentioned, the first one is deprecated, all clear. I just wanted to point out that none of them work in my case.&lt;/P&gt;
&lt;P&gt;If the setting logical length doesn't help, I will try default constructor and&amp;nbsp;&lt;SPAN&gt;setFitData(...) / setNurbsData(...) to see return values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 16:24:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7512245#M7482</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-02T16:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbSpline constructor problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7512321#M7483</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;bjevtic wrote: &lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Regarding array initialization:&lt;/P&gt;
&lt;P&gt;What confuses me is that I can use array initialized and filled in this way to draw AcDbLines. I will set logical length explicitly to 6 at the beginning and try that way. &lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Have a look at the implementation of the &lt;FONT face="courier new,courier"&gt;AcArray&amp;lt;T&amp;gt;&lt;/FONT&gt; methods. As it is a template class they are all in the header acarray.h.&lt;/P&gt;
&lt;P&gt;Look at &lt;FONT face="courier new,courier"&gt;operator[](int i)&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;isValid(int i)&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;template &amp;lt;class T, class R&amp;gt; inline T&amp;amp;
AcArray&amp;lt;T,R&amp;gt;::operator [] (int i)
{ AC_ARRAY_ASSERT(this-&amp;gt;isValid(i)); return mpArray[i]; }&lt;BR /&gt;&lt;BR /&gt;template &amp;lt;class T, class R&amp;gt; inline bool&lt;BR /&gt;AcArray&amp;lt;T,R&amp;gt;::isValid(int i) const&lt;BR /&gt;{ return i &amp;gt;= 0 &amp;amp;&amp;amp; i &amp;lt; mLogicalLen; }&lt;BR /&gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;ptAry[i]&lt;/FONT&gt; will return the i-th array elment &lt;FONT face="courier new,courier"&gt;ptAry&lt;/FONT&gt;.&lt;FONT face="courier new,courier"&gt;mpArray[i]&lt;/FONT&gt; - if&amp;nbsp; &lt;FONT face="courier new,courier"&gt;AC_ARRAY_ASSERT(isValid(i))&lt;/FONT&gt;&amp;nbsp; doesn't stop the program.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;isValid(i)&lt;/FONT&gt; will return false - so it depends on the definition of &lt;FONT face="courier new,courier"&gt;AC_ARRAY_ASSERT&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;#ifdef ASSERT
#define AC_ARRAY_ASSERT ASSERT
#elif defined assert
#define AC_ARRAY_ASSERT assert
#elif defined _ASSERTE
#define AC_ARRAY_ASSERT _ASSERTE
#else
#define AC_ARRAY_ASSERT(T)
#endif
&lt;/PRE&gt;
&lt;P&gt;So if neither &lt;FONT face="courier new,courier"&gt;ASSERT&lt;/FONT&gt; nor &lt;FONT face="courier new,courier"&gt;assert&lt;/FONT&gt; nor &lt;FONT face="courier new,courier"&gt;_ASSERTE&lt;/FONT&gt; is defined your &lt;EM&gt;logically&lt;/EM&gt;&amp;nbsp; empty array behaves as if it has the correct logical length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 16:42:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7512321#M7483</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2017-11-02T16:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbSpline constructor problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7512518#M7484</link>
      <description>&lt;P&gt;&lt;EM&gt;!!!!&lt;/EM&gt;, i got it now. i can access the elements (memory) to write and read but the array is logically still 0. i haven't seen this implementation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that's&amp;nbsp;the problem for sure, cant wait to test it tomorrow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(edit: no curse words on the forum...)&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 17:36:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7512518#M7484</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-02T17:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbSpline constructor problem</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7514417#M7485</link>
      <description>&lt;P&gt;that was it.&lt;/P&gt;
&lt;P&gt;setLogicalLength()&lt;/P&gt;
&lt;P&gt;thanks a lot for the help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 09:47:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbspline-constructor-problem/m-p/7514417#M7485</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-03T09:47:23Z</dc:date>
    </item>
  </channel>
</rss>

