Radius and angle issues with addArc

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
Rambler
Registered Member
Posts: 2
Joined: Tue Jan 28, 2020 12:00 am

Radius and angle issues with addArc

Post by Rambler » Wed Jan 29, 2020 11:26 pm

If I type addArc(10,10,100,1.5,3) at the command line of the script shell I get an arc of radius 1.74 (wrong), starting at 1.5 degrees (wrong, =value treated as a degrees value where it should be treated as radians) and ending at 171 degrees. The addCircle command has a similar radius parameter but gets it right.

Also, if I enter an undefined parameter, e.g. addArc(10,10,100,1.5, end) where "end" is declared but has no value assigned, the error text is confused, viz:

ecma> addArc(10,10,100,1.5, end)
Error: :-1:-1: RArc(): no matching constructor found. <native>(10, 10, 1.7453292519943295, 0.02617993877991494, undefined) at -1 addArc(center = 10, radius = 10, startAngle = 100, endAngle = 1.5, reversed = undefined) at :/scripts/simple_create.js:195 <eval>() at 1 <native>('js', 'addArc(10,10,100,1.5, end) ') at -1 <anonymous>(expression = 'addArc(10,10,100,1.5, end) ') at :scripts/Misc/MiscDevelopment/EcmaScriptShell/EcmaScriptShell.js:349 <anonymous>(command = 'addArc(10,10,100,1.5, end)') at :scripts/Misc/MiscDevelopment/EcmaScriptShell/EcmaScriptShell.js:256 <native>() at -1 main() at :scripts\autostart.js:826 <global>() at :scripts\autostart.js:839

This happens both on my PC (Windows 10, x86, QCAD 3.24.2) and macBook (macOS 10.15, QCAD 3.24.2)

CVH
Premier Member
Posts: 3475
Joined: Wed Sep 27, 2017 4:17 pm

Re: Radius and angle issues with addArc

Post by CVH » Thu Jan 30, 2020 11:08 pm

AddArc is a function in simple_create.js
Apart from that you are missing 'reversed' in your trial code.
Usage is:
* addArc(cx,cy, radius, startAngle, endAngle, reversed)
* addArc([cx,cy], radius, startAngle, endAngle, reversed)
* addArc(new RVector(cx,cy), radius, startAngle, endAngle, reversed)
With 5 entrys it is required that the first one is an array or an RVector.

The functions of simple_create.js use degrees for angles.

Regards,
CVH

Rambler
Registered Member
Posts: 2
Joined: Tue Jan 28, 2020 12:00 am

Re: Radius and angle issues with addArc [SOLVED]

Post by Rambler » Thu Jan 30, 2020 11:27 pm

Thanks, CVH. That's now working for me. I just wish I could have found that in the documentation!

CVH
Premier Member
Posts: 3475
Joined: Wed Sep 27, 2017 4:17 pm

Re: Radius and angle issues with addArc

Post by CVH » Thu Jan 30, 2020 11:42 pm

Try
https://www.qcad.org/doc/qcad/latest/de ... tated.html
but don't get lost. :D
Regards,
CVH

Post Reply

Return to “QCAD Troubleshooting and Problems”