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

Class Op

cadquery/occ_impl/shapes.py:5537–5635  ·  view source on GitHub ↗

Operation history element.

Source from the content-addressed store, hash-verified

5535
5536
5537class Op:
5538 """
5539 Operation history element.
5540 """
5541
5542 _name: str | None
5543 _tracked: set[Shape]
5544 _deleted: list[Shape]
5545 _modified: dict[Shape, Shape]
5546 _generated: dict[Shape, Shape]
5547 _images: dict[Shape, Shape]
5548 _first: dict[Shape, Shape]
5549 _last: dict[Shape, Shape]
5550 _first_shape: Shape
5551 _last_shape: Shape
5552
5553 def __init__(self, name: str | None = None) -> None:
5554
5555 self._name = name if name else None
5556
5557 self._tracked = set()
5558 self._deleted = []
5559 self._modified = {}
5560 self._generated = {}
5561 self._images = {}
5562 self._first = {}
5563 self._last = {}
5564 self._first_shape = compound()
5565 self._last_shape = compound()
5566
5567 def _get(self, d: dict[Shape, Shape], k: Shape) -> Shape:
5568
5569 if k.ShapeType() == "Compound":
5570 tmp: list[Shape] = []
5571
5572 for el in k:
5573 val = d[el]
5574 if val.ShapeType() == "Compound":
5575 tmp.extend(val)
5576 else:
5577 tmp.append(val)
5578
5579 return _normalize(compound(tmp))
5580 else:
5581 return _normalize(d[k])
5582
5583 def modified(self, s: Shape | None = None) -> Shape:
5584 """
5585 Shapes modified from s.
5586 """
5587
5588 if s:
5589 return self._get(self._modified, s)
5590
5591 return _normalize(compound(*self._modified.values()))
5592
5593 def generated(self, s: Shape | None = None) -> Shape:
5594 """

Callers 2

_update_historyFunction · 0.85
TpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected