scripting qcad?

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
bobself
Junior Member
Posts: 14
Joined: Tue Jul 21, 2015 7:28 pm

scripting qcad?

Post by bobself » Wed Jul 22, 2015 1:11 pm

Is it possible to have QCAD execute scripts to produce drawings? How about from C++ using the API? I mean, by not even running QCAD's graphical interface. I googled for the answer to that but only found stuff about writing plugins.

Further searching, I found an example of doing this in javascript: http://www.qcad.org/doc/qcad/latest/dev ... awing.html

Is there an example in C++? Using Qt, I guess.

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

Re: scripting qcad?

Post by andrew » Wed Jul 22, 2015 1:23 pm

Yes, have a look at the 'merge' command line tool included with QCAD consisting of:
- the launcher bash or batch scripts: merge / merge.bat
- the implementation in ECMAScript (JavaScript): scripts/Tools/MergeDrawings

bobself
Junior Member
Posts: 14
Joined: Tue Jul 21, 2015 7:28 pm

Re: scripting qcad?

Post by bobself » Wed Jul 22, 2015 1:42 pm

OK. I can use javascript if I have to, but is there a C++ example?

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

Re: scripting qcad?

Post by andrew » Wed Jul 22, 2015 2:39 pm

bobself wrote:but is there a C++ example?
No. JavaScript is the way to go.

You can write plugins in C++ provided you are using the same Qt version, compiler and compiler version we're using. Using the script interface is certainly far less painful.

Post Reply

Return to “QCAD 'How Do I' Questions”