Comments (8)
After search through Google and Github, I try Ask Claude AI
https://claude.ai/
Q: use libnest2d to nesting 100 random rectrangle, the nesting result is a circle, but supposed to nest in a rectangle shape, help me debug
A:
There are a few things that could cause the nesting result to be a circle rather than a rectangle when using libnest2d to nest 100 random rectangles:
-
The bounding box is not being set correctly - libnest2d will nest shapes within the bounding box provided. Make sure you are setting an appropriate rectangular bounding box, not a circular one.
-
Shapes are being rotated - libnest2d will rotate shapes to find the optimal nesting. If you don't want rotation, disable it with the no_rotation option.
-
Order of input shapes - Try changing the order of the input rectangle list to get different nesting output. Some orders may lend better to a circular result.
-
Not enough space for proper nesting - If the bounding box is too small to fit all the rectangles efficiently, it may result in a circular-looking layout. Try increasing the bounding box size.
-
Bad initial placement - The initial placement seed can affect nesting. Try changing the config place_seeds option.
-
Sub-optimal packing algorithm - Libnest2d has different packing algorithms. Test different ones like bottom-left or contact-point to see if it improves the rectilinear nesting.
To properly debug, I would start by printing out the bounding box coordinates and enabling visual output to see exactly what is happening. Also try nesting just a few rectangles first to check the baseline behavior. With some targeted debugging and experimentation, you should be able to get the desired rectangular nesting.
from pynest2d.
Trying PrusaSlicer-2.6.0
seems arrange Items in circle is the default behavior
from pynest2d.
and it's the default arrange behavior of Cura 5.4
from pynest2d.
Come across a similar question on libnest2d:
Strange "starting_point" behavior in NfpPlacer · Issue #52 · tamasmeszaros/libnest2d
tamasmeszaros/libnest2d#52
from pynest2d.
try nest() with BottomLeft Placer
config_rect = BottomLeftConfig()
config_rect.allow_rotations = False
num_bins = nest(List_Items, volume, spacing, config_rect)
get this error
TypeError: nest(): argument 4 has unexpected type 'BottomLeftConfig'
help(nest)
Help on built-in function nest in module pynest2d:
nest(...)
Arrange a number of items in bins, packing them closely with the goal to
minimise the number of bins necessary to pack all given items.
This function uses the FirstFit selector and NfpPPlacer in its algorithms,
and Clipper as geometry back-end.
The result of the packing is stored in the transformation of the input
items. You can get the transformed items by calling transformedShape() on
each of the items, or by looking at their rotation and translation. Items
may also be placed on alternative bins if the first bin is not big enough to
fit all items.
:param items: An iterable of Item instances which are the items that need to
be placed in the bins.
:param bin: The shape in which to place these items.
:param distance: (Default 1.) The distance to hold between adjacent items in
the final pack result. Items will not get placed closer than this distance.
Must be at least 1 unit.
:param config: An NfpConfig instance that contains configuration options to
specialize how objects get placed. Defaults will be used if this is not
provided.
:return: The number of bins necessary to fit all items.
:param config: An NfpConfig instance that contains configuration options
seems only NfpConfig is supported.
from pynest2d.
look into source code of libnest2d, seems BottomLeftPlacer is implemented as well.
libnest2d/src/libnest2d.cpp at 359d71fb4e5a951c17228f4be75b432187ca4993 · Ultimaker/libnest2d
https://github.com/Ultimaker/libnest2d/blob/359d71fb4e5a951c17228f4be75b432187ca4993/src/libnest2d.cpp
from pynest2d.
[Doubt] - Using BottomLeftConfig · Issue #25 · Ultimaker/pynest2d
#25
from pynest2d.
So to use BottomLeftPlacer, seems I have to change some code and build a new pynest2d.pyd
pynest2d/python/pynest2d.sip at main · Ultimaker/pynest2d
https://github.com/Ultimaker/pynest2d/blob/main/python/pynest2d.sip
from pynest2d.
Related Issues (14)
- Action Required: Fix WhiteSource Configuration File - .whitesource
- Cannot compile 4.13-beta HOT 2
- Shape mirrored after applying `.transformedShape()` after nest HOT 1
- Drop in favor of markfink/nest2D (LGPL now!) HOT 1
- Overlapped polygons output HOT 2
- Error and can't Install & Build pynest2d
- [Doubt] - Using BottomLeftConfig HOT 2
- Can't build mac m1 HOT 8
- cmake error at cmakelist.txt:5 (find_package)
- Built on Linux, how to use in venv HOT 3
- SIGSEGV error on import
- Tag release for libnest2d HOT 2
- SIP version HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pynest2d.