addSimpleText - need help

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
JSRoy
Junior Member
Posts: 11
Joined: Fri Sep 22, 2017 9:28 pm

addSimpleText - need help

Post by JSRoy » Mon Feb 25, 2019 2:56 am

Hi all,

Maybe its late and my brain is not functioning properly, but I'm having a lot of problems using addSimpleText.

I am trying to use it in its simplest form:

Code: Select all

addSimpleText('test', 0, 0);
This gives me the following error:
Script exception in script '/home/jsroy/Documents/qcadScriptTest2.js': Error: : -1: -1: RTextData(): no matching constructor found. <native>(1, 1, 1, 100, 0, 0, 1, 2, 1, 'test', 'Standard', false, false, 0, true) at -1 addSimpleText(text = 'test', position = 1, height = 1) at /home/jsroy/opt/qcadcam-3.17.3-pro-linux-x86_64/scripts/simple_create.js:-1 anonymous() at 36 <anonymous>() at scripts/Misc/MiscDevelopment/RunScript/RunScript.js:117 <eval>() at 1 <native>() at -1 main() at scripts/autostart.js:769 <global>() at scripts/autostart.js:782

Any help would be appreciated.

Thank you,

Jean-Sebastien Roy

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

Re: addSimpleText - need help

Post by andrew » Mon Feb 25, 2019 10:24 am

This set of parameters is currently not supported.

Instead, try:

Code: Select all

addSimpleText('test', [0, 0]);
or:

Code: Select all

addSimpleText('test', new RVector(0, 0));
or the full set of parameters:

Code: Select all

addSimpleText('test', 0, 0, height, angle, font, vAlign, hAlign, bold, italic);

JSRoy
Junior Member
Posts: 11
Joined: Fri Sep 22, 2017 9:28 pm

Re: addSimpleText - need help

Post by JSRoy » Tue Feb 26, 2019 3:16 pm

Thank you Andrew. That fixed my problem :)

User avatar
dfriasb
Senior Member
Posts: 119
Joined: Thu Mar 10, 2016 1:08 pm
Location: Calafell, Tarragona, Spain

Re: addSimpleText - need help

Post by dfriasb » Tue Apr 07, 2020 10:22 pm

Maybe I'm typing wrong, but full set of parameters is not working for me:

Code: Select all

addSimpleText('test', 0, 0, 0.15, 45, "Standard", "VAlignMiddle", "HAlignCenter", false, false)
Any help will be appreciated. Regards,
David.
David Frías Barranco | architect
[email protected] | davidfriasarquitecto.es

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

Re: addSimpleText - need help

Post by andrew » Wed Apr 08, 2020 8:43 am

Code: Select all

addSimpleText("test", 0,0, 0.15, 45, "Standard", RS.VAlignMiddle, RS.HAlignCenter, false, false);

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”