SebKuzminsky / pycam

Other
342 stars 101 forks source link

restore pycam.Geometry.Line.get_line_length() #78

Closed SebKuzminsky closed 7 years ago

SebKuzminsky commented 7 years ago

NOTE: This PR is for the new "stable/0.6" branch, because it addresses a bug in that branch. If this PR is accepted, I will merge the bug fix into the master branch so it gets fixed there too.

This function was removed in commit 52b80196 "removed unused code (reported by 'vulture')", but it is actually used by pycam.Geometry.Polygon.is_connectable(). vulture just missed it.

You can see the problem that arises when this function is missing by following this recipe:

1. Start pycam.
2. Delete the default model.
3. Import a 2d model.
4. Create a new Tool (all default).
5. Create a new Process, Engraving, select the 2d model from step 3,
   enable radius compensation.
6. Create a new Bounds (all default).
7. Create a new Task (all default)>
8. Click Generate Toolpath.

Before this commit (but after 52b80196), pycam fails to produce a sensible toolpath. After this commit, the correct toolpath is generated.

SebKuzminsky commented 7 years ago

It's probably better to update Geometry.Polygon.is_connectable() to check the type of the object explicitly. Comments?

sumpfralle commented 7 years ago

Great findings! It was surely quite a ride to track this problem down ...

I followed your advice and used the explicit type check in is_connectable. Could you please check if commit e5ac1baf1434f2913ca4847875003751f9f18f06 (on master) fixes the issue for you? I have an unrelated problem with inkscape or pstoedit and thus cannot test it on my own. Thank you!

SebKuzminsky commented 7 years ago

Thanks @sumpfralle for the much better fix in master. I cherry-picked it into stable/0.6.