Custom tool design

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.

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

Re: Custom tool design

Post by CVH » Tue Nov 15, 2022 8:12 am

Husky wrote:
Mon Nov 14, 2022 3:14 am
QCAD will not start anymore.
kdwoll wrote:
Mon Nov 14, 2022 3:58 am
if you run debug you will see the problem.
Uncaught exception at C:/Program Files/QCAD\scripts/nTruss/nTrussBottom/nTrussBottom.js:7: Error: include: cannot read file 'scripts/Library.js'

I think that needs to be library.js with a lower 'l'. e_geek

Regards,
CVH

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

Re: Custom tool design

Post by CVH » Mon Nov 21, 2022 7:05 am

Hi,

When running under the QCAD GUI it is mostly not required to include library.js.
It can be ruled out at the top of nTrussBottom.js and nTrussBottomD.js.

Code: Select all

// ### CVH Bug fix ### Bug prevents QCAD from loading: 'library.js' in lower script
//include("scripts/library.js");    // ### CVH Ruled out ###
After that QCAD will boot up normally with an additional menu called 'Truss Nailer'.

Husky wrote:
Mon Nov 14, 2022 3:14 am
What is the reason to locate it higher up in the QCAD paths hierarchy?
The Truss Nailer package is installed as folder under the QCAD scripts folder.
That can be in the installation path or in the user path.

Husky wrote:
Mon Nov 14, 2022 3:14 am
2. What is and where is to find this "INIT button"?
kdwoll wrote:
Mon Nov 14, 2022 3:58 am
2. You have to unhide the nTruss toolbar....
It is not required to unhide the nTruss toolbar, nTrussInit.js can be activated from the menu or from the toolbar.

Husky wrote:
Mon Nov 14, 2022 3:14 am
3. The drawing has 1294 duplicates
Not exploded from the latest zip I find but 160 duplicates, all Polylines.
Probably because it are several layers of wood that needs to be nailed/pinned/glued together. :wink:

Husky wrote:
Mon Nov 14, 2022 3:14 am
3. The drawing has 152 Zero-length entities.
kdwoll wrote:
Mon Nov 14, 2022 3:58 am
Is a point zero length?
Sure, a point has no size but a zero-length entity is not a point although it is also displayed as a dot but then as a smaller dot.
There are none in the not exploded version of the file.
It seems that some to more Polylines on layer $$PURLINS$$ have duplicate nodes.
The segments between them explode to zero-length line entities.
I am not in favor to actually cast these as drawing entities.



@kdwoll aka Kevin Wollmann, Newdale Design Ltd.
Some remarks:
- There are several attempts to declare globals in your code.
Mostly unused and/or not required. The danger sits in overwriting existing globals.
For example: nTruss.js declares Space1 ... Offset2 but nTrussOptions.js stores values in nTruss.Space1 ... nTruss.Offset2, only these are used later.
On top, there is no input validation.
- I understand that it is intended for drawings in inch (Also see nTrussOptions.ui).
But what with drawings in other units, metric units?
- nTrussOutput.js is not exporting a Block list in CSV format to my knowledge.
It is rather exporting G-code so far I can detect.
I would have expected a G20 instruction when working in inches.
The odd thing is that it turns on the spindle in clockwise direction and hovers over the work piece at 2 units height.
- I would code nTrussOutput.js with a single state, now the 'ZeroPoint' instruction is only displayed on the Command Line.
Rather confusing when asked for selecting an entity or region or moving an entity or reference in the Status Bar.
- In several places you are trying to auto translate user information.
That will only happen when you provide translations files for other languages.
On top, you are trying to auto translate the RVector.toString() text of the ZeroPoint.
- What with other points in a drawing? What with their custom property and the sorting based on that?
- About widgets are normally with a single button, that can be with OK or with Close only.


It is indeed some functional code together that will do a very specific job. :P
The hardest to understand is the initial point and mirror plane with Mirrored Webs.
What if there is no central vertical part to put some nails in?

Regards,
CVH

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

Re: Custom tool design

Post by CVH » Sun Jan 22, 2023 1:04 pm

Important notice for everyone:

The nTruss package will corrupt the QCAD tools in DrawOrder and perhaps others.

Also See: https://qcad.org/bugtracker/index.php?d ... sk_id=2443

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”