gumyr / build123d

A python CAD programming library
Apache License 2.0
505 stars 85 forks source link

Add surface of revolution feature (revolve edge into a face) #579

Open jdegenstein opened 7 months ago

jdegenstein commented 7 months ago

Currently I don't believe it is possibly to directly revolve an edge into a face in build123d (commonly known as a surface of revolution). I suspect this is supported at the OCCT level.

gumyr commented 7 months ago

This can be done at the direct api level with an extra step of extracting the Face from the not really valid Solid:

with BuildLine(Plane.XZ) as outline:
    arc = JernArc((0, 0), (1, 0), 3, 90)

revolution = Solid.revolve(arc.edge(), 360, Axis.Z).face()

image

However, this was not included by design. Having to create a Face first helps ensure the Wire is closed (OCCT will produce strange results but not necessarily an error with an open Wire) and simplifies the operations by having Face as the input not Face or Wire which makes the API more complex.

The BuildSurface builder would likely need this functionality though so maybe Wire revolutions could be introduced then?