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

Problem with external thread with parameter end_finishes=("chamfer","square") #86

Open
yguel opened this issue Feb 1, 2024 · 0 comments

Comments

@yguel
Copy link

yguel commented Feb 1, 2024

When modifying the code from the thread_example.py and change the finishes for external threads from ("fade","square") to :
either ("square", "chamfer") or ("chamfer","square") the thread is not produced.
Maybe I do not understand correctly those parameters. From the doc I expect one of the two to be for the bottom of the cylinder and the other for the top of the cylinder.

If I understand correctly, I expect that bug to be a problem with the occ_kernel.
Do you have ideas how to solve it ?

Furthermore when I use the ("square","square") parameter I expect the result to be clamped at the beginning and end of the iso_external_core cylinder, but on the bottom it extends.

Below is the code I used:

import timeit

from cq_warehouse.thread import (
    IsoThread
)

MM = 1

def external_example():
    """IsoThread External Example"""
    starttime = timeit.default_timer()
    iso_external_thread = IsoThread(
        major_diameter=6 * MM,
        pitch=1 * MM,
        length=10 * MM,
        external=True,
        #end_finishes=("fade", "square"),
        end_finishes=("square", "chamfer"),
        #end_finishes=("chamfer","square"),
        #end_finishes=("chamfer","chamfer"),
        #end_finishes=("square", "square"),
        #end_finishes=("fade", "fade"),
        #end_finishes=("fade","chamfer"),
        hand="right"
        #hand="left"
    )
    elapsed_time = timeit.default_timer() - starttime

    iso_external_core = (
        cq.Workplane("XY")
        .circle(iso_external_thread.min_radius)
        .extrude(iso_external_thread.length)
    )
    iso_external = iso_external_thread.cq_object.fuse(iso_external_core.val())
    print(f"{iso_external.isValid()=}")

    show_object(iso_external_thread.cq_object, name="iso_external_thread")
    show_object(iso_external_core, name="iso_external_core")
    show_object(iso_external, name="iso_external")

external_example()

I think I might be able to secure some processing time to perform unit tests with all the possible configurations.
I am just not sure how to test automatically that the result is correct, at least it could be possible to detect when the result is empty for the thread or just a cylinder for the union of the thread and the core.
I would like to have the thoughts of others about the feasibility and the soundness of such kind of tests.

I would like to finish by express my thanks to the developers of cq_warehouse it was really features lacking in cadQuery and it makes cq much, much more complete for CAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant