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

Add Edge.make_parabola #722

Open
jdegenstein opened this issue Oct 1, 2024 · 0 comments
Open

Add Edge.make_parabola #722

jdegenstein opened this issue Oct 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jdegenstein
Copy link
Collaborator

Quick prototype, arbitrarily chose the two-angle signature for GC_MakeArcOfParabola

from build123d import *
from OCP.gp import gp_Parab
from OCP.GC import GC_MakeArcOfParabola
from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
from math import radians

@classmethod
def _make_parabola(
    cls,
    focal_length: float,
    start_angle: float,
    end_angle: float,
    plane: Plane = Plane.XY,
) -> Edge:
    parabola_gp = gp_Parab(plane.to_gp_ax2(), focal_length)

    parabola_geom = GC_MakeArcOfParabola(
        parabola_gp, radians(start_angle), radians(end_angle), True
    ).Value()

    return cls(BRepBuilderAPI_MakeEdge(parabola_geom).Edge())

Edge.make_parabola = _make_parabola

test_parabola = Edge.make_parabola(focal_length=.1, start_angle=-20, end_angle=30, plane=Plane.XY)

image

@jdegenstein jdegenstein added the enhancement New feature or request label Oct 1, 2024
@jdegenstein jdegenstein added this to the Not Gating Release 1.0.0 milestone Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant