Fix DXF polygon loading by correctly joining oriented segments#264
Fix DXF polygon loading by correctly joining oriented segments#264tokoro10g wants to merge 1 commit intoreilleya:stagingfrom
Conversation
Update the polygon editor's segment-joining loop to properly handle all four endpoint-to-endpoint proximity cases. By allowing reversal of both the primary and comparison chunks, segments can be joined into a continuous path regardless of their initial direction.
|
Hi! Thanks for the contribution. Do you have an example DXF that doesn't load? Took me a moment to think through the existing code, but I believe it is right. In your example, line 90 actually does because and this block of code reverses the second chunk in the array (not the first) before concatenating them: Totally possible I'm missing something, though! |
|
Thank you for this awesome project! Sorry, I was looking at the wrong line, l.93 had an error. It was implemented like This cannot be solved by simply swapping so I decided to add another flag for flipping. |
|
Huh, yeah, looks like line 93 is incorrect! Thanks. Before I merge the change, do you have an example of a DXF that doesn't load without this change? I don't think I've ever run into a DXF that the software couldn't load (as long as it only includes elements the software knows about) so I'm kind of confused about how this was broken. Maybe it is very rare compared to the other cases? |
This PR fixes the polygon loading algorithm.
For example, if we haveit tries to join the segments like the following in l.90:which is obviously invalid. It should performC = A + flip(B)instead.