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

cut with solid from parametricCurve #260

Closed
asprionj opened this issue Dec 28, 2019 · 3 comments · Fixed by #1156
Closed

cut with solid from parametricCurve #260

asprionj opened this issue Dec 28, 2019 · 3 comments · Fixed by #1156
Labels
bug Something isn't working OCC kernel issue

Comments

@asprionj
Copy link

(I'm on 2.0RC1.) Trying to cut a body that is constructed by revolving a parametricCurve from another body. For illustration, a minimal example which is working as expected, but using a circle instead of said parametricCurve:

s = cq.Workplane('XY').circle(50).extrude(20) # the base body
to_cut = cq.Workplane('XY').transformed(offset=[35,0,0], rotate=[90,0,0]).circle(14).revolve(315, [-35,0,0], [-35,1,0]) # this will be cut away
s = s.cut(to_cut) # cut it...

The result looks fine (I cannot fully close the torus because of #259):
image

Now, if I use a parametricCurve, e.g. to have an ellipse instead of a circle (or any other complex geometry):

from math import sin, cos, pi

def my_ellipse(t, a, b):
    return (a*sin(2*pi*t), b*cos(2*pi*t))

to_cut = cq.Workplane('XY').transformed(offset=[35,0,0], rotate=[90,0,0]).parametricCurve(lambda t: my_ellipse(t,14,7)).revolve(315, [-35,0,0], [-35,1,0])

it fails with "RuntimeError: Standard_Failure Courbes non jointives". (Also when using intersect instead of cut.)

Funny thing is, if I use union instead of cut, it does work as expected:
image

@adam-urbanczyk adam-urbanczyk added bug Something isn't working OCC kernel issue labels Dec 28, 2019
@adam-urbanczyk
Copy link
Member

Confirmed, looks like a cad kernel issue. Same workaround as in #259 :

from math import sin, cos, pi

def my_ellipse(t, a, b):
    return (a*sin(2*pi*t), b*cos(2*pi*t))

to_cut = cq.Workplane('XY').transformed(offset=[35,0,0], rotate=[90,0,0]).parametricCurve(lambda t: my_ellipse(t,14,7)).revolve(360, [-35,0,0], [-35,1,0],clean=False)

s = cq.Workplane('XY').circle(50).extrude(20)
s = s.cut(to_cut,clean=False)

show_object(s)

afbeelding

@lorenzncode
Copy link
Member

Fixed in occt7.6 branch.

from math import sin, cos, pi

def my_ellipse(t, a, b):
    return (a*sin(2*pi*t), b*cos(2*pi*t))

s = cq.Workplane('XY').circle(50).extrude(20) # the base body
to_cut = cq.Workplane('XY').transformed(offset=[35,0,0], rotate=[90,0,0]).parametricCurve(lambda t: my_ellipse(t,14,7)).revolve(315, [-35,0,0], [-35,1,0])
s = s.cut(to_cut)

print(s.val().isValid())

occt7.6:
image

current master (ocp-7.5.3):
image

@adam-urbanczyk
Copy link
Member

Thanks @lorenzncode for checking - I'm adding this issue to the PR.

@adam-urbanczyk adam-urbanczyk linked a pull request Sep 23, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OCC kernel issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants