Can I use qcad javascript in node.js?

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
wwponv158
Newbie Member
Posts: 6
Joined: Wed Nov 02, 2022 6:01 am

Can I use qcad javascript in node.js?

Post by wwponv158 » Wed Nov 02, 2022 6:19 am

Recently I purchased a qcad server license.

I bought that product and looked at the examples, but I don't know how to do it.

Wasn't it considered at all and should I simply use the command line? Or is there any other way I can use it in node.js?

Sorry for asking a rude question.

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

Re: Can I use qcad javascript in node.js?

Post by andrew » Wed Nov 02, 2022 8:55 am

QCAD runs its own JavaScript engine to provide the extensive Qt and QCAD API to scripts and execute them. QCAD does not use node.js but the Qt QScriptEngine which integrates well with the Qt toolkit.

To use QCAD in a server environment, you can use the provided command line tools or create your own command line tools. You can run commands in node.js using the child_process module.

wwponv158
Newbie Member
Posts: 6
Joined: Wed Nov 02, 2022 6:01 am

Re: Can I use qcad javascript in node.js?

Post by wwponv158 » Wed Nov 02, 2022 9:56 am

For example, if I move the simple API to another directory and run it, does it work well? For example using require or import.

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

Re: Can I use qcad javascript in node.js?

Post by andrew » Wed Nov 02, 2022 9:58 am

No. Again, QCAD has no relationship with Node.js at all. QCAD scripts can only run in the context of QCAD. I.e. QCAD runs the scripts.

b1991b
Registered Member
Posts: 2
Joined: Tue Feb 07, 2023 7:03 pm

Re: Can I use qcad javascript in node.js?

Post by b1991b » Tue Feb 07, 2023 7:07 pm

You can run a qcad command line script using spawn() to spawn a child process in node.js. I have done it for long dwg2maptiles jobs.

Post Reply

Return to “QCAD 'How Do I' Questions”