dwgnest is not able to find solution with margin 40 mm

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
estibalizEchevarria
Newbie Member
Posts: 7
Joined: Fri Feb 23, 2024 9:27 am

dwgnest is not able to find solution with margin 40 mm

Post by estibalizEchevarria » Mon Dec 15, 2025 2:55 pm

Hello!
I am using QCAD Professional 3.29.3 on Linux and running nesting via the command-line tool dwgnest. While testing different nesting configurations for the same sheet, I noticed an unexpected behavior related to margin and tolerance. For margins greater than 40 mm, dwgnest is not able to find a solution with the default tolerance value of 0.01. In some cases, increasing the value helps to find a solution, but not always.
For example, I have several pieces of 140x140 that I want to place into an area of 1100x750
merged_3.0mm.dxf
(22.67 KiB) Downloaded 49 times
. Therefore, easily could be place at least 6 pieces inside the area with a margin of 40 mm. But dwgnest is only able to place all of them if the tolerance is increase to 12 instead of 0.01 (default value)
This is the full comand used for tolerance -t 0.01:
'~/opt/qcadcam-3.29.3-pro-linux-x86_64/dwgnest -f -sheets=bandeja -parts=PieceMaxAgujero_0,PieceMaxAgujero_1,PieceMaxAgujero_2,PieceMaxAgujero_3,PieceMaxAgujero_4,PieceMaxAgujero_5 -n 1 -m 40 -a 0 -e 0 -no-align -i 400 -r 4 -o /home/lis-devs/packtecserver/nesting/output/out_3mm_6.dxf /home/lis-devs/packtecserver/nesting/output/merged_3.0mm.dxf -platform offscreen'
solution_nest.png
solution_nest.png (42.56 KiB) Viewed 4565 times
This for tolerance -t 12:
~/opt/qcadcam-3.29.3-pro-linux-x86_64/dwgnest -f -sheets=bandeja -parts=PieceMaxAgujero_0,PieceMaxAgujero_1,PieceMaxAgujero_2,PieceMaxAgujero_3,PieceMaxAgujero_4,PieceMaxAgujero_5 -n 1 -m 40 -a 0 -e 0 -no-align -i 400 -r 4 -t 12 -o /home/lis-devs/packtecserver/nesting/output/out_3mm_6.dxf /home/lis-devs/packtecserver/nesting/output/merged_3.0mm.dxf -platform offscreen
soluton_nest_tol12.png
soluton_nest_tol12.png (40.47 KiB) Viewed 4565 times

This happens with any piece that wants to be placed with margin value greater than 40mm. And with some margins, increasing the tolerance does not solve the problem.
Why does dwgnest fail to find solutions for larger margins when using a small tolerance, even though a solution clearly exists?
Is this behavior expected due to how tolerance is applied during geometry simplification and offsetting, or is there another constraint or heuristic at play?
Any clarification would be appreciated.

Best regards
Attachments
out_3mm_6.dxf
(148.92 KiB) Downloaded 59 times

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

Re: dwgnest is not able to find solution with margin 40 mm

Post by CVH » Mon Dec 15, 2025 3:40 pm

Hi,

Also noticed that in out_3mm_6.dxf the two pieces at the bottom are within 37 and 31 units of the piece above them.
There are also a few things wrong with the top left.

About units.
Is it correct that the substrate is 1100 by 750 meters?
Never encountered such a CNC table but is there a practical limit? :lol:

Here it won't matter because QCAD works in plain units.

Regards,
CVH

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

Re: dwgnest is not able to find solution with margin 40 mm

Post by andrew » Mon Dec 15, 2025 6:09 pm

Thanks for your report.

Bug report added at:
https://www.qcad.org/bugtracker/index.p ... sk_id=2698

This problem should be fixed for the next release.

estibalizEchevarria
Newbie Member
Posts: 7
Joined: Fri Feb 23, 2024 9:27 am

Re: dwgnest is not able to find solution with margin 40 mm

Post by estibalizEchevarria » Tue Dec 16, 2025 8:54 am

Hi CVH,

Thanks for the reply.

You're absolutely right about the distances. In out_3mm_6.dxf, some parts end up closer than the requested 40 units (ranging from approximately 31–37 mm), and even the piece in the top corner isn't correctly positioned.
This happens because the contour simplification due to tolerance, combined with sheet-margin set to 0, means the real spacing between pieces—and between pieces and the sheet edge—is no longer guaranteed.
The sheet is a simple 1100 × 750 mm rectangle. You mentioned a CNC table, and you're right that dwgnest is designed for cutting operations.
Since dwgnest is designed for CNC cutting with maximum packing efficiency, could it be rejecting the >39 mm margin as unrealistic for this area, treating it as an error rather than a valid constraint?

Post Reply

Return to “QCAD Troubleshooting and Problems”