Help with addArc function

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
linux478
Newbie Member
Posts: 3
Joined: Mon Sep 06, 2021 5:37 am

Help with addArc function

Post by linux478 » Sat Jun 25, 2022 5:51 pm

OS: Debian GNU/Linux 11 (bullseye)

I am trying to make a script that uses the addArc function. The script below has the error message. To get the error message with running the code, make sure you have a 'b' in the input.

Thank you for your time,
Michael

Code: Select all

input = getText("User Input","Enter the text","");
point = new RVector(0,0);

while (input != "") {
  switch(input[0].toUpperCase()) {
    case "A":
      addLine(point.getX(),point.getY(),point.getX() + .5,point.getY()+1);
      addLine(point.getX() + .5,point.getY()+1,point.getX() + 1,point.getY());
      addLine(point.getX() + .25,point.getY()+.5,point.getX() + .75,point.getY()+.5);
    break;
    case "B":
      addLine(point.getX(),point.getY(),point.getX(),point.getY()+1);
      addLine(point.getX(),point.getY()+1,point.getX()+0.75,point.getY()+1);
      addLine(point.getX(),point.getY()+.5,point.getX()+0.75,point.getY()+.5);
      addLine(point.getX(),point.getY(),point.getX()+0.75,point.getY());

/* ==== Error ====

Script exception in script '/home/michael/Documents/testing.js': Error: :-1:-1: RArc(): no matching constructor found. <native>("RVector(0.750000, 0.750000, 0.000000, 1)", 0.25, 4.71238898038469, 1.5707963267948966, 1) at -1 addArc(center = "RVector(0.750000, 0.750000, 0.000000, 1)", radius = 0.25, startAngle = 270, endAngle = 90, reversed = 1) at :/scripts/simple_create.js:-1 addArc(center = 0.75, radius = 0.75, startAngle = 0.25, endAngle = 270, reversed = 90, 1) at :/scripts/simple_create.js:189 anonymous() at 27 <anonymous>() at :scripts/Misc/MiscDevelopment/RunScript/RunScript.js:120 <eval>() at 1 <native>() at -1 main() at :scripts/autostart.js:839 <global>() at :scripts/autostart.js:852

*/
      addArc(point.getX()+.75,
             point.getY()+.75,
             .25,
             270,
             90,
             1
            );

/* ==== End Error ==== */

    break;
    case "E":
      addLine(point.getX(),point.getY(),point.getX(),point.getY()+1);
      addLine(point.getX(),point.getY()+1,point.getX()+1,point.getY()+1);
      addLine(point.getX(),point.getY()+.5,point.getX()+1,point.getY()+.5);
      addLine(point.getX(),point.getY(),point.getX()+1,point.getY());
    break;
    default:
      addLine(point.getX(),point.getY(),point.getX() + 1,point.getY()+1);
    break;
  }
	  
  point = new RVector(point.getX() +2,point.getY());
  input = input.substr(1);
}
Thank you for your time,
Michael

OS: Debian GNU/Linux 11 (bullseye)
QCAD: 3.27.6.0

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

Re: Help with addArc function

Post by CVH » Sat Jun 25, 2022 6:26 pm

Hi,

I supect that the variable reversed is boolean 'true' or 'false' and not a number.

Regards,
CVH

linux478
Newbie Member
Posts: 3
Joined: Mon Sep 06, 2021 5:37 am

[SOLVED] Re: Help with addArc function

Post by linux478 » Sat Jun 25, 2022 7:00 pm

you are correct. thank you
Thank you for your time,
Michael

OS: Debian GNU/Linux 11 (bullseye)
QCAD: 3.27.6.0

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”