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

Fix "1d" sweep #484

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/build123d/operations_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ def sweep(
new_faces = []
if edge_list:
for sec in section_list:
swept = Face.sweep(sec, path_wire) # Could generate a shell here
swept = Face.sweep(sec, path_wire, transition)
new_faces.extend(swept.faces())

if context is not None:
Expand Down
19 changes: 11 additions & 8 deletions src/build123d/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -4269,6 +4269,9 @@
def wires(self) -> list[Wire]:
"""A list of wires created from the edges"""
return Wire.combine(self.edges())

def to_wire(self) -> Wire:
return Wire.make_wire(self.edges())

Check warning on line 4274 in src/build123d/topology.py

View check run for this annotation

Codecov / codecov/patch

src/build123d/topology.py#L4274

Added line #L4274 was not covered by tests


class Edge(Mixin1D, Shape):
Expand Down Expand Up @@ -5385,15 +5388,15 @@
return sewn_faces

@classmethod
def sweep(cls, profile: Edge, path: Union[Edge, Wire]) -> Face:
def sweep(cls, profile: Union[Edge, Wire], path: Union[Edge, Wire], transition=Transition.RIGHT) -> Face:
"""Sweep a 1D profile along a 1D path"""
if isinstance(path, Edge):
path = Wire.make_wire([path])
# Ensure the edges in the path are ordered correctly
path = Wire.make_wire(path.order_edges())
pipe_sweep = BRepOffsetAPI_MakePipe(path.wrapped, profile.wrapped)
pipe_sweep.Build()
return Face(pipe_sweep.Shape())
profile = profile.to_wire()
path = Wire.make_wire(path.to_wire().order_edges())
builder = BRepOffsetAPI_MakePipeShell(path.wrapped)
builder.Add(profile.wrapped, False, False)
builder.SetTransitionMode(Solid._transModeDict[transition])
builder.Build()
return Shape.cast(builder.Shape()).clean().face()

@classmethod
def make_surface_from_array_of_points(
Expand Down
Loading