QCAD code writing tool confusion

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

QCAD code writing tool confusion

Post by WildWolfCJ » Mon Dec 25, 2023 4:02 am

qcad 3.28 pro win10
I am writing a js script, and I find it very difficult. I usually use visual studio for work, and VS has a very good association function. Is there any similar IDE tool for writing QCAD scripts?How can you quickly find a certain class and certain information?

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: QCAD code writing tool confusion

Post by CVH » Mon Dec 25, 2023 7:42 am

WildWolfCJ wrote:
Mon Dec 25, 2023 4:02 am
Is there any similar IDE tool for writing QCAD scripts?
None public that I know of.

The complete QCAD CE open source collection of tool scripts and much more:
https://github.com/qcad/qcad

The QCAD Application Framework:
https://qcad.org/doc/qcad/3.0/developer/
Here you might be interested in:
- Core classes: https://qcad.org/doc/qcad/3.0/developer ... _core.html
- CAD entities classes: https://qcad.org/doc/qcad/3.0/developer ... ntity.html
- Basic mathematical concepts & geometrical classes: https://qcad.org/doc/qcad/3.0/developer ... _math.html
- Operation classes: https://qcad.org/doc/qcad/3.0/developer ... tions.html
Besides that there are some key libraries in ECMAScript as for example: library.js, ShapeAlgorithms.js, ...

Regards,
CVH

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD code writing tool confusion

Post by WildWolfCJ » Tue Dec 26, 2023 3:28 am

HI CVH Thank you for your reply, you really helped me a lot.
I am currently using the RPolygonOffset class, but include("scripts/Pro/Modify/OffsetPro/RPolygonOffset.js"); contains an error message. How should I modify it? I couldn't find any relevant information in the forum.

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: QCAD code writing tool confusion

Post by CVH » Tue Dec 26, 2023 2:25 pm

The RPolygonOffset() class is implemented in a different way as the older OffsetProWorker(), you don't need to included the base script.
Or you don't have to when the GUI is running and there are no references mentioned on how/what to include.

Please refer for implementations of RPolygonOffset() to:
https://www.qcad.org/rsforum/viewtopic. ... 553#p15553

Other methods of interest when var worker = RPolygonOffset( ... ); :
  • worker.addPolyline( .RPolyline. );
    worker.getWarnings();
    worker.setDisableClipping(..);
    =false/true
    worker.setForceInside(..); =false/true
    worker.setForceInside(..); =false/true
    worker.setForceOpen(..); =false/true
    worker.setToleranceClipping( .double. );
    worker.setToleranceJoining( .double.);
As explained, JoinType and EndType are defined in RS.h and the more direct links are:
https://www.qcad.org/doc/qcad/latest/de ... e748f1f849
https://www.qcad.org/doc/qcad/latest/de ... d718237a6d

In ECMAScript RS::JoinRound is written as RS.JoinRound for example.
Several different types are enumerated ... Not all types are (yet?) supported.

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”