Sweep edge, wire or face along a path. For faces cap has no effect. Do not mix faces with other types.
(
s: Shape,
path: Shape,
aux: Shape | None = None,
cap: bool = False,
transition: Literal["transformed", "round", "right"] = "transformed",
history: History | None = None,
name: str | None = None,
)
| 7125 | |
| 7126 | @multidispatch |
| 7127 | def sweep( |
| 7128 | s: Shape, |
| 7129 | path: Shape, |
| 7130 | aux: Shape | None = None, |
| 7131 | cap: bool = False, |
| 7132 | transition: Literal["transformed", "round", "right"] = "transformed", |
| 7133 | history: History | None = None, |
| 7134 | name: str | None = None, |
| 7135 | ) -> Shape: |
| 7136 | """ |
| 7137 | Sweep edge, wire or face along a path. For faces cap has no effect. |
| 7138 | Do not mix faces with other types. |
| 7139 | """ |
| 7140 | |
| 7141 | spine = _get_one_wire(path) |
| 7142 | |
| 7143 | results: list[TopoDS_Shape] = [] |
| 7144 | builders = [] |
| 7145 | |
| 7146 | def _make_builder() -> BRepOffsetAPI_MakePipeShell: |
| 7147 | |
| 7148 | rv = BRepOffsetAPI_MakePipeShell(spine.wrapped) |
| 7149 | if aux: |
| 7150 | rv.SetMode(_get_one_wire(aux).wrapped, True) |
| 7151 | else: |
| 7152 | rv.SetMode(False) |
| 7153 | |
| 7154 | rv.SetTransitionMode(_trans_mode_dict[transition]) |
| 7155 | |
| 7156 | return rv |
| 7157 | |
| 7158 | # try to get faces |
| 7159 | faces = s.Faces() |
| 7160 | |
| 7161 | # if faces were supplied |
| 7162 | if faces: |
| 7163 | # for history handling |
| 7164 | tops_hist = [] |
| 7165 | bots_hist = [] |
| 7166 | solid_hist = History() |
| 7167 | |
| 7168 | for f in faces: |
| 7169 | builder = _make_builder() |
| 7170 | builders.append(builder) |
| 7171 | |
| 7172 | builder.Add(f.outerWire().wrapped, False, False) |
| 7173 | builder.Build() |
| 7174 | builder.MakeSolid() |
| 7175 | |
| 7176 | # for bookkeeping of inner sweeps and cap construction |
| 7177 | builders_inner = [] |
| 7178 | tops = [] |
| 7179 | bots = [] |
| 7180 | sides = [] |
| 7181 | |
| 7182 | # extract the outer side and initial cap |
| 7183 | bot = Shape(builder.FirstShape()) |
| 7184 | top = Shape(builder.LastShape()) |