Drawing circles from a script?

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
markrubin
Registered Member
Posts: 2
Joined: Thu Aug 13, 2015 12:30 am

Drawing circles from a script?

Post by markrubin » Thu Aug 13, 2015 12:35 am

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

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

Re: Drawing circles from a script?

Post by andrew » Thu Aug 13, 2015 11:01 am

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.

markrubin
Registered Member
Posts: 2
Joined: Thu Aug 13, 2015 12:30 am

Re: Drawing circles from a script?

Post by markrubin » Wed Aug 19, 2015 12:47 pm

That's perfect! Thank you!

Post Reply

Return to “QCAD 'How Do I' Questions”