Update history based on specified shapes and builders.
(
history: History | None,
name: str | None,
shapes: Sequence[Shape],
*builders: BuilderType,
)
| 5713 | |
| 5714 | |
| 5715 | def _update_history( |
| 5716 | history: History | None, |
| 5717 | name: str | None, |
| 5718 | shapes: Sequence[Shape], |
| 5719 | *builders: BuilderType, |
| 5720 | ) -> None: |
| 5721 | """ |
| 5722 | Update history based on specified shapes and builders. |
| 5723 | """ |
| 5724 | |
| 5725 | if history: |
| 5726 | # construct the history step |
| 5727 | op = Op() |
| 5728 | |
| 5729 | history.append(op, name) |
| 5730 | |
| 5731 | # track all subshapes |
| 5732 | for shape in shapes: |
| 5733 | op._tracked.update(shape.Faces()) |
| 5734 | op._tracked.update(shape.Edges()) |
| 5735 | op._tracked.update(shape.Vertices()) |
| 5736 | |
| 5737 | # iterate over all builders and collect history information |
| 5738 | builder: Any |
| 5739 | for builder in builders: |
| 5740 | has_first_last = isinstance( |
| 5741 | builder, (BRepPrimAPI_MakeRevol, BRepPrimAPI_MakePrism,), |
| 5742 | ) |
| 5743 | has_first_last_shape = isinstance( |
| 5744 | builder, |
| 5745 | ( |
| 5746 | BRepPrimAPI_MakeRevol, |
| 5747 | BRepPrimAPI_MakePrism, |
| 5748 | BRepOffsetAPI_MakePipeShell, |
| 5749 | BRepFeat_MakePrism, |
| 5750 | BRepFeat_MakeDPrism, |
| 5751 | ), |
| 5752 | ) |
| 5753 | has_generated = isinstance( |
| 5754 | builder, |
| 5755 | ( |
| 5756 | BRepPrimAPI_MakeRevol, |
| 5757 | BRepPrimAPI_MakePrism, |
| 5758 | BRepOffsetAPI_MakePipeShell, |
| 5759 | BRepTools_History, |
| 5760 | BRepBuilderAPI_MakeShape, |
| 5761 | BOPAlgo_Builder, |
| 5762 | BRepOffset_MakeOffset, |
| 5763 | ), |
| 5764 | ) |
| 5765 | has_modifidied = isinstance( |
| 5766 | builder, |
| 5767 | ( |
| 5768 | BRepPrimAPI_MakeRevol, |
| 5769 | BRepPrimAPI_MakePrism, |
| 5770 | BRepOffsetAPI_MakePipeShell, |
| 5771 | BRepTools_History, |
| 5772 | BRepBuilderAPI_MakeShape, |
no test coverage detected