addSpline does not draw the line but create the controlPoints

Use this forum for all posts and questions about the free QCAD Community Edition version 3

Moderator: andrew

Post Reply
tedesco.jg
Newbie Member
Posts: 3
Joined: Tue Mar 31, 2020 1:36 am

addSpline does not draw the line but create the controlPoints

Post by tedesco.jg » Tue Mar 31, 2020 2:33 am

Hi. I'm trying to draw a NACA 0014 airfoil on a QCAD community edition drawing using ECMA script.
After running the script nothing is drawn. If you type CTRL+A all the points are selected and the Properties window says it is a Spline but you can see the line joining the points.
The script runs correctly in the PRO version during the trial period and shows the line. But even if you save it as a DXF file in the PRO version, opening it in the community edition the line is not shown.

Can anybody help me on what to do to make the line appears?

The script is as follows:

v=[];
v.push([1.00000,0.00147]);
v.push([0.99587,0.00214]);
v.push([0.98917,0.00323]);
v.push([0.98181,0.00441]);
v.push([0.97377,0.00570]);
v.push([0.96507,0.00707]);
v.push([0.95578,0.00852]);
v.push([0.94594,0.01003]);
v.push([0.93568,0.01160]);
v.push([0.92509,0.01319]);
v.push([0.91424,0.01480]);
v.push([0.90321,0.01642]);
v.push([0.89204,0.01804]);
v.push([0.88079,0.01965]);
v.push([0.86945,0.02125]);
v.push([0.85805,0.02284]);
v.push([0.84661,0.02441]);
v.push([0.83515,0.02596]);
v.push([0.82366,0.02750]);
v.push([0.81216,0.02902]);
v.push([0.80066,0.03052]);
v.push([0.78915,0.03200]);
v.push([0.77763,0.03345]);
v.push([0.76610,0.03489]);
v.push([0.75456,0.03631]);
v.push([0.74305,0.03772]);
v.push([0.73152,0.03909]);
v.push([0.71998,0.04045]);
v.push([0.70847,0.04179]);
v.push([0.69695,0.04309]);
v.push([0.68541,0.04438]);
v.push([0.67390,0.04566]);
v.push([0.66239,0.04690]);
v.push([0.65087,0.04812]);
v.push([0.63935,0.04932]);
v.push([0.62785,0.05050]);
v.push([0.61635,0.05165]);
v.push([0.60486,0.05277]);
v.push([0.59338,0.05387]);
v.push([0.58192,0.05494]);
v.push([0.57047,0.05598]);
v.push([0.55901,0.05700]);
v.push([0.54756,0.05798]);
v.push([0.53613,0.05894]);
v.push([0.52472,0.05987]);
v.push([0.51332,0.06076]);
v.push([0.50193,0.06162]);
v.push([0.49056,0.06245]);
v.push([0.47921,0.06324]);
v.push([0.46787,0.06400]);
v.push([0.45657,0.06471]);
v.push([0.44527,0.06539]);
v.push([0.43399,0.06603]);
v.push([0.42273,0.06662]);
v.push([0.41149,0.06718]);
v.push([0.40029,0.06769]);
v.push([0.38913,0.06816]);
v.push([0.37798,0.06857]);
v.push([0.36687,0.06894]);
v.push([0.35577,0.06925]);
v.push([0.34472,0.06952]);
v.push([0.33370,0.06973]);
v.push([0.32272,0.06989]);
v.push([0.31179,0.06998]);
v.push([0.30089,0.07002]);
v.push([0.29006,0.06999]);
v.push([0.27927,0.06990]);
v.push([0.26853,0.06975]);
v.push([0.25785,0.06953]);
v.push([0.24725,0.06924]);
v.push([0.23673,0.06887]);
v.push([0.22627,0.06842]);
v.push([0.21589,0.06790]);
v.push([0.20564,0.06731]);
v.push([0.19548,0.06662]);
v.push([0.18544,0.06587]);
v.push([0.17556,0.06502]);
v.push([0.16581,0.06409]);
v.push([0.15626,0.06308]);
v.push([0.14692,0.06199]);
v.push([0.13781,0.06081]);
v.push([0.12895,0.05957]);
v.push([0.12040,0.05826]);
v.push([0.11217,0.05689]);
v.push([0.10430,0.05546]);
v.push([0.09681,0.05399]);
v.push([0.08971,0.05249]);
v.push([0.08302,0.05097]);
v.push([0.07674,0.04944]);
v.push([0.07087,0.04791]);
v.push([0.06540,0.04638]);
v.push([0.06031,0.04486]);
v.push([0.05558,0.04336]);
v.push([0.05118,0.04188]);
v.push([0.04709,0.04042]);
v.push([0.04330,0.03899]);
v.push([0.03977,0.03757]);
v.push([0.03649,0.03617]);
v.push([0.03343,0.03479]);
v.push([0.03058,0.03342]);
v.push([0.02792,0.03208]);
v.push([0.02543,0.03074]);
v.push([0.02310,0.02942]);
v.push([0.02092,0.02811]);
v.push([0.01888,0.02681]);
v.push([0.01697,0.02551]);
v.push([0.01519,0.02422]);
v.push([0.01352,0.02292]);
v.push([0.01195,0.02163]);
v.push([0.01050,0.02034]);
v.push([0.00914,0.01904]);
v.push([0.00789,0.01774]);
v.push([0.00673,0.01644]);
v.push([0.00566,0.01513]);
v.push([0.00469,0.01381]);
v.push([0.00381,0.01249]);
v.push([0.00303,0.01116]);
v.push([0.00233,0.00983]);
v.push([0.00173,0.00850]);
v.push([0.00122,0.00717]);
v.push([0.00081,0.00584]);
v.push([0.00048,0.00452]);
v.push([0.00024,0.00320]);
v.push([0.00008,0.00190]);
v.push([0.00001,0.00063]);
v.push([0.00001,-0.00063]);
v.push([0.00008,-0.00190]);
v.push([0.00024,-0.00320]);
v.push([0.00048,-0.00452]);
v.push([0.00081,-0.00584]);
v.push([0.00122,-0.00717]);
v.push([0.00173,-0.00850]);
v.push([0.00233,-0.00983]);
v.push([0.00303,-0.01116]);
v.push([0.00381,-0.01249]);
v.push([0.00469,-0.01381]);
v.push([0.00566,-0.01513]);
v.push([0.00673,-0.01644]);
v.push([0.00789,-0.01774]);
v.push([0.00914,-0.01904]);
v.push([0.01050,-0.02034]);
v.push([0.01195,-0.02163]);
v.push([0.01352,-0.02292]);
v.push([0.01519,-0.02422]);
v.push([0.01697,-0.02551]);
v.push([0.01888,-0.02681]);
v.push([0.02092,-0.02811]);
v.push([0.02310,-0.02942]);
v.push([0.02543,-0.03074]);
v.push([0.02792,-0.03208]);
v.push([0.03058,-0.03342]);
v.push([0.03343,-0.03479]);
v.push([0.03649,-0.03617]);
v.push([0.03977,-0.03757]);
v.push([0.04330,-0.03899]);
v.push([0.04709,-0.04042]);
v.push([0.05118,-0.04188]);
v.push([0.05558,-0.04336]);
v.push([0.06031,-0.04486]);
v.push([0.06540,-0.04638]);
v.push([0.07087,-0.04791]);
v.push([0.07674,-0.04944]);
v.push([0.08302,-0.05097]);
v.push([0.08971,-0.05249]);
v.push([0.09681,-0.05399]);
v.push([0.10430,-0.05546]);
v.push([0.11217,-0.05689]);
v.push([0.12040,-0.05826]);
v.push([0.12895,-0.05957]);
v.push([0.13781,-0.06081]);
v.push([0.14692,-0.06199]);
v.push([0.15626,-0.06308]);
v.push([0.16581,-0.06409]);
v.push([0.17556,-0.06502]);
v.push([0.18544,-0.06587]);
v.push([0.19548,-0.06662]);
v.push([0.20564,-0.06731]);
v.push([0.21589,-0.06790]);
v.push([0.22627,-0.06842]);
v.push([0.23673,-0.06887]);
v.push([0.24725,-0.06924]);
v.push([0.25785,-0.06953]);
v.push([0.26853,-0.06975]);
v.push([0.27927,-0.06990]);
v.push([0.29006,-0.06999]);
v.push([0.30089,-0.07002]);
v.push([0.31179,-0.06998]);
v.push([0.32272,-0.06989]);
v.push([0.33370,-0.06973]);
v.push([0.34472,-0.06952]);
v.push([0.35577,-0.06925]);
v.push([0.36687,-0.06894]);
v.push([0.37798,-0.06857]);
v.push([0.38913,-0.06816]);
v.push([0.40029,-0.06769]);
v.push([0.41149,-0.06718]);
v.push([0.42273,-0.06662]);
v.push([0.43399,-0.06603]);
v.push([0.44527,-0.06539]);
v.push([0.45657,-0.06471]);
v.push([0.46787,-0.06400]);
v.push([0.47921,-0.06324]);
v.push([0.49056,-0.06245]);
v.push([0.50193,-0.06162]);
v.push([0.51332,-0.06076]);
v.push([0.52472,-0.05987]);
v.push([0.53613,-0.05894]);
v.push([0.54756,-0.05798]);
v.push([0.55901,-0.05700]);
v.push([0.57047,-0.05598]);
v.push([0.58192,-0.05494]);
v.push([0.59338,-0.05387]);
v.push([0.60486,-0.05277]);
v.push([0.61635,-0.05165]);
v.push([0.62785,-0.05050]);
v.push([0.63935,-0.04932]);
v.push([0.65087,-0.04812]);
v.push([0.66239,-0.04690]);
v.push([0.67390,-0.04566]);
v.push([0.68541,-0.04438]);
v.push([0.69695,-0.04309]);
v.push([0.70847,-0.04179]);
v.push([0.71998,-0.04045]);
v.push([0.73152,-0.03909]);
v.push([0.74305,-0.03772]);
v.push([0.75456,-0.03631]);
v.push([0.76610,-0.03489]);
v.push([0.77763,-0.03345]);
v.push([0.78915,-0.03200]);
v.push([0.80066,-0.03052]);
v.push([0.81216,-0.02902]);
v.push([0.82366,-0.02750]);
v.push([0.83515,-0.02596]);
v.push([0.84661,-0.02441]);
v.push([0.85805,-0.02284]);
v.push([0.86945,-0.02125]);
v.push([0.88079,-0.01965]);
v.push([0.89204,-0.01804]);
v.push([0.90321,-0.01642]);
v.push([0.91424,-0.01480]);
v.push([0.92509,-0.01319]);
v.push([0.93568,-0.01160]);
v.push([0.94594,-0.01003]);
v.push([0.95578,-0.00852]);
v.push([0.96507,-0.00707]);
v.push([0.97377,-0.00570]);
v.push([0.98181,-0.00441]);
v.push([0.98917,-0.00323]);
v.push([0.99587,-0.00214]);
v.push([1.00000,-0.00147]);
addSpline(v, false);
autoZoom();

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 3126
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: addSpline does not draw the line but create the controlPoints

Post by Husky » Tue Mar 31, 2020 3:43 am

Hi,
tedesco.jg wrote:
Tue Mar 31, 2020 2:33 am
After running the script nothing is drawn. If you type CTRL+A all the points are selected and the Properties window says it is a Spline but you can see the line joining the points.
unfortunately the script is using tools which are not part of the QCAD Community Edition. :(

It works fine in QCAD Professional:

Husky-2020.03.30-01.png
Husky-2020.03.30-01.png (7.02 KiB) Viewed 676 times
Work smart, not hard: QCad Pro

If a thread is considered as "solved" please change the title of the first post to "[solved] Title...". Thanks!

tedesco.jg
Newbie Member
Posts: 3
Joined: Tue Mar 31, 2020 1:36 am

Re: addSpline does not draw the line but create the controlPoints

Post by tedesco.jg » Tue Mar 31, 2020 10:04 am

Ok, Husky. Thanks for the answer.
But why the DXF file generated by the PRO version when open with the Community edition does not show the line?
If it was generated correctly in the PRO version it should appear in the Community edition when opening the file.
Thanks again.

User avatar
andrew
Site Admin
Posts: 6867
Joined: Fri Mar 30, 2007 6:07 am

Re: addSpline does not draw the line but create the controlPoints

Post by andrew » Tue Mar 31, 2020 10:13 am

QCAD CE has no support for splines from fit points (it requires the proprietary OpenDesign libraries to to the math for the interpolation which also affects the rendering).

tedesco.jg
Newbie Member
Posts: 3
Joined: Tue Mar 31, 2020 1:36 am

Re: addSpline does not draw the line but create the controlPoints

Post by tedesco.jg » Tue Mar 31, 2020 10:40 am

Thanks, andrew, for you answer.
Is there a way to change the script to make it works on the CE edition?
Thanks again.

CVH
Premier Member
Posts: 684
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: addSpline does not draw the line but create the controlPoints

Post by CVH » Tue Mar 31, 2020 11:13 am

Not with fitpoint splines.

I read you go back and forth between CE and PRO
The workaround would be:
Generate it under pro with one extra reference
EDIT: ( really doesn't care a lot where, but fairly inline is best ).
Set a crosser line in that last node.
Trim the fitpoint spline to the crosser.

Your fitpoint spline should turn into a trimmed spline with controlpoints.
Spline with controlpoints are supported in CE.

Explosion of a spline is a polyline with bulges, also supported in CE.
EDIT; ( set an appropiated explosion options in App.Prefs )

Replace addSpline() by addPolyline() and you get your shape interpolated by line segments.

Regards,
CVH
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

Post Reply

Return to “QCAD Community Edition”