Can scripts output to a text file?

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

Moderator: andrew

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

Can scripts output to a text file?

Post by JSRoy » Fri Feb 22, 2019 10:55 pm

Hi all,

I am developing a script to draw lines. When I run my script, qCad is not drawing what I am expecting.

I would like to review all values I am using in my script when calling addLine(). Is there a way for me to create a text file and output my data into it? I have over 700 points, so having a text file would make it easier to review my data and find out what is wrong.


Regards,

Jean-Sebastien Roy

RR88
Active Member
Posts: 27
Joined: Sun Apr 29, 2018 7:04 am
Location: Leinefelde

Re: Can scripts output to a text file?

Post by RR88 » Fri Feb 22, 2019 11:50 pm

Gentoo/Linux, QCad 3.20 Prof.

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

Re: Can scripts output to a text file?

Post by JSRoy » Sat Feb 23, 2019 2:57 am

Thank you RR88,

With your help I managed to figure out my problem. The Math.sin() function expect an angle expressed as a radiant. I was giving it an angle in degrees.

Would you know where to find the Math class in the document? I found RMath, but no mentions of Math.


Thank you,

Jean-Sebastien Roy
Last edited by JSRoy on Sat Feb 23, 2019 2:03 pm, edited 1 time in total.

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

Re: Can scripts output to a text file?

Post by andrew » Sat Feb 23, 2019 10:29 am

Note that Math is part of the JavaScript API, not QCAD:
https://www.w3schools.com/js/js_math.asp

RR88
Active Member
Posts: 27
Joined: Sun Apr 29, 2018 7:04 am
Location: Leinefelde

Re: Can scripts output to a text file?

Post by RR88 » Sat Feb 23, 2019 5:20 pm

JSRoy wrote:
Sat Feb 23, 2019 2:57 am
The Math.sin() function expect an angle expressed as a radiant. I was giving it an angle in degrees.

Code: Select all

Math.sin(angle*Math.PI/180)
:P
Gentoo/Linux, QCad 3.20 Prof.

Post Reply

Return to “QCAD Developers and Contributors”