Page 1 of 1

Can I use qcad javascript in node.js?

Posted: Wed Nov 02, 2022 6:19 am
by wwponv158
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.

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

Posted: Wed Nov 02, 2022 8:55 am
by andrew
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.

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

Posted: Wed Nov 02, 2022 9:56 am
by wwponv158
For example, if I move the simple API to another directory and run it, does it work well? For example using require or import.

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

Posted: Wed Nov 02, 2022 9:58 am
by andrew
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.

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

Posted: Tue Feb 07, 2023 7:07 pm
by b1991b
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.