Page 1 of 1

Drawing circles from a script?

Posted: Thu Aug 13, 2015 12:35 am
by markrubin
Hi - I'm new here. Just downloaded QCAD and ordered the book. I will attempt to learn the basics in the next few weeks, but I have a question in advance of the learning...

I would like to create a script to draw 20-30 circles of various areas, colors, and positions in QCAD. I know that QCAD supports scripting and it doesn't look too difficult to figure out. With that said, I looked at the example scripts and couldn't find what I want to do. I don't want to create a menu item that would enable me to draw one circle at a time. I'm looking for some sort of batch way to create them.

Can anyone point me in the direction of an example that might help me learn how to do this?

Thanks!
Mark

Re: Drawing circles from a script?

Posted: Thu Aug 13, 2015 11:01 am
by andrew
If this is a one time project, you can use the script shell:

View > Toolbars > Script Shell

You can enter ECMAScript (JavaScript) into the script shell directly, e.g.:
for (i=0; i<10; i++) { addCircle(10,i*10,i); }
This script uses the simplified API as defined in scripts/simple.js.

Re: Drawing circles from a script?

Posted: Wed Aug 19, 2015 12:47 pm
by markrubin
That's perfect! Thank you!