Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in unify_paths_orientation: points are deleted and paths not always unified well #148

Open
joburger opened this issue Aug 1, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@joburger
Copy link
Collaborator

joburger commented Aug 1, 2021

It seems like 'unify paths orientation' is not always giving the intended behaviour. I found this out by investigating the behaviour of close_paths(self) in the Base Slicer. I thought it was strange that after slicing a geometry with CGAL, it is still necessary for the script to add extra points to close the paths. This is strange, because if a path is closed according to CGAL Slicing, it must already have the same first as the same last point (path.points[0] == path.points[-1]). So what currently happens:

  • Slicing using cgal, results in a closed path with points[0] == points[-1].
  • Unify paths orientation somehow removes a point.
  • Close paths puts back the point.

I think the result of 'unify paths orientation' should already be a closed path, without the need of additionally closing the path in a next step right? I.e.: ideally we don't need the 'close_paths' function to ever trigger.

Img1: Slicing result with unify path orientation and close paths commented out:

image

Img2: Slicing result with close paths commented out (and unify paths orientation on):

image

Additonally, I think unify paths orientation does not always unify the direction correctly, and sometimes it can even mess up the orientation of paths that were perfectly fine after just the slicing result. This should be investigated more.

Code used (very simple):
Model I can still share if necessary but it should be the same for all models.


MODEL = 'start_stop_fix_test_geo.stl'

    compas_mesh = Mesh.from_stl(os.path.join(DATA, MODEL))

    slicer = PlanarSlicer(compas_mesh, slicer_type="cgal", layer_height=20.00)
    slicer.slice_model()

    simplify_paths_rdp_igl(slicer, threshold=0.9)
    seams_align(slicer, "next_path")

    slicer.printout_info()

    save_to_json(slicer.to_data(), OUTPUT_DIR, 'slicer_data.json')

    print_organizer = PlanarPrintOrganizer(slicer)
    print_organizer.create_printpoints()

    set_extruder_toggle(print_organizer, slicer)
    add_safety_printpoints(print_organizer, z_hop=60.0)
    set_linear_velocity_constant(print_organizer, v=100.0)
    set_blend_radius(print_organizer, d_fillet=10.0)

    print_organizer.printout_info()

    printpoints_data = print_organizer.output_printpoints_dict()
    utils.save_to_json(printpoints_data, OUTPUT_DIR, 'out_printpoints.json')
@joburger joburger added the bug Something isn't working label Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant