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

## Can scripts output to a text file?

**Moderator:** andrew

### Re: Can scripts output to a text file?

What about writeTextFile (https://www.qcad.org/doc/qcad/3.0/devel ... 06da9eed90)? This is the definition of the function https://github.com/qcad/qcad/blob/maste ... y.js#L2424.

Gentoo/Linux, QCad 3.20 Prof.

### Re: Can scripts output to a text file?

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

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.

### Re: Can scripts output to a text file?

Note that Math is part of the JavaScript API, not QCAD:

https://www.w3schools.com/js/js_math.asp

https://www.w3schools.com/js/js_math.asp

### Re: Can scripts output to a text file?

Code: Select all

`Math.sin(angle*Math.PI/180)`

Gentoo/Linux, QCad 3.20 Prof.