MCPcopy
hub / github.com/CadQuery/cadquery / _update_history

Function _update_history

cadquery/occ_impl/shapes.py:5715–5817  ·  view source on GitHub ↗

Update history based on specified shapes and builders.

(
    history: History | None,
    name: str | None,
    shapes: Sequence[Shape],
    *builders: BuilderType,
)

Source from the content-addressed store, hash-verified

5713
5714
5715def _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,

Callers 15

shellFunction · 0.85
fuseFunction · 0.85
cutFunction · 0.85
intersectFunction · 0.85
splitFunction · 0.85
imprintFunction · 0.85
filletFunction · 0.85
chamferFunction · 0.85
extrudeFunction · 0.85
revolveFunction · 0.85
offsetFunction · 0.85
sweepFunction · 0.85

Calls 6

OpClass · 0.85
_compound_or_shapeFunction · 0.85
appendMethod · 0.80
EdgesMethod · 0.80
FacesMethod · 0.45
VerticesMethod · 0.45

Tested by

no test coverage detected