Skip to content

ArcArcTangentArc placing result at wrong spot sometimes #983

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

Open
jdegenstein opened this issue May 2, 2025 · 1 comment
Open

ArcArcTangentArc placing result at wrong spot sometimes #983

jdegenstein opened this issue May 2, 2025 · 1 comment

Comments

@jdegenstein
Copy link
Collaborator

jdegenstein commented May 2, 2025

I can't figure out how to reproduce more concisely, and I originally believed it was related to edges being reversed, but that does not appear to be the case in my investigation. cc @jwagenet since you know more about these new objects than anyone.

Image

with BuildPart() as p:
    with BuildLine() as l:
        m1 = JernArc((160/2,0),(1,0),220,-39.327)
        print(m1@1)
    with BuildSketch() as s:
        with PolarLocations(0,4):
            SlotArc(m1,80)
    extrude(amount=30)

    with BuildSketch() as s2:
        add(s.sketch)
        offset(amount=-20)
    extrude(amount=30,mode=Mode.SUBTRACT)

ax = Axis((0,0,0),(1,1,0))
e1 = s.sketch.edges().filter_by_position(ax,0,30).sort_by(Axis.X)
zz = ArcArcTangentArc(e1[0],e1[1],25,side=Side.LEFT) # placed incorrectly, length is same as later uses, swapping sides does not fix it but create a different wrong result

b1 = CenterArc((80,0),40,90,180)
b2 = CenterArc((0,80),40,0,-180)
aata = ArcArcTangentArc(b1,b2,25,side=Side.RIGHT) # works fine

r1 = Edge(b1.wrapped.Reversed())
r2 = Edge(b2.wrapped.Reversed())
raata = ArcArcTangentArc(r1,r2,25,side=Side.RIGHT) # also works fine
@jwagenet
Copy link
Contributor

jwagenet commented May 7, 2025

Oops, good catch! This error does seem to be related to the edge direction being reversed, specifically start_arc, and should only happen when the object is created out of context. What seems to be happening is in algebra mode a workplane is made using the start_arc normal to set the plane normal and while the arc is actually in the right place (because the plane is flipped), but the point ordering for RadiusArc is wrong.

I think the easiest solution is to check the tangency of the resulting arc as the construction points are not in the correct order in this case. I suspect planes with "negative" normals are to blame. The one loose end here (and I dont think this object behavior is to blame) is for algebra mode users Side results may remain unintuitive when the reference edges come from other compound objects as in this case.

A workaround for now is to create the object in a BuildLine context:

    with BuildLine() as l2:
        ax = Axis((0,0,0),(1,1,0))
        e1 = s.sketch.edges().filter_by_position(ax,0,30).sort_by(Axis.X)
        zz = ArcArcTangentArc(e1[0],e1[1],25,side=Side.RIGHT)

Notes

I confirmed edge direction by showing the first vert of each. The edges from the previous operations are reversed (clockwise) from those created by CenterArc (counterclockwise). I'm not fluent in OCP-land, but Edge(b1.wrapped.Reversed()) did not reverse the edges as intended. I'm able to reproduce the error with Edge.reversed() instead:

r1 = b1.reversed()
r2 = b2.reversed()
raata = ArcArcTangentArc(r1,r2,25,side=Side.RIGHT)

Further, I can reproduce with the first arc reversed ArcArcTangentArc(r1,b2,25,side=Side.RIGHT), but not with the second reversed ArcArcTangentArc(b1,r2,25,side=Side.RIGHT), which means the error is related how the workplane is created outside of a context and point ordering when creating arc with RadiusArc.

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

2 participants