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

Method replace

cadquery/occ_impl/shapes.py:1872–1890  ·  view source on GitHub ↗

Replace old subshape with new subshapes.

(self, old: Shape, *new: Shape)

Source from the content-addressed store, hash-verified

1870 self.forConstruction = data[1]
1871
1872 def replace(self, old: Shape, *new: Shape) -> Self:
1873 """
1874 Replace old subshape with new subshapes.
1875 """
1876
1877 tools: list[Shape] = []
1878
1879 for el in new:
1880 if isinstance(el, Compound):
1881 tools.extend(el)
1882 else:
1883 tools.append(el)
1884
1885 bldr = BRepTools_ReShape()
1886 bldr.Replace(old.wrapped, compound(tools).wrapped)
1887
1888 rv = bldr.Apply(self.wrapped)
1889
1890 return self.__class__(rv)
1891
1892 def remove(self, *subshape: Shape) -> Self:
1893 """

Callers

nothing calls this directly

Calls 3

compoundFunction · 0.85
extendMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected