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

Method toLocs

cadquery/occ_impl/shapes.py:1906–1926  ·  view source on GitHub ↗

Convert self to a list of locations.

(self)

Source from the content-addressed store, hash-verified

1904 return self.__class__(rv)
1905
1906 def toLocs(self) -> list[Location]:
1907 """
1908 Convert self to a list of locations.
1909 """
1910
1911 rv: list[Location] = []
1912 t = self.ShapeType()
1913
1914 if t == "Compound":
1915 for el in self:
1916 rv.extend(el.toLocs())
1917 elif t == "Face":
1918 u0, u1, v0, v1 = tcast(Face, self).uvBounds()
1919 rv.append(tcast(Face, self).locationAt((u1 + u0) / 2, (v1 + v0) / 2))
1920 elif t == "Edge":
1921 u0, u1 = tcast(Edge, self).bounds()
1922 rv.append(tcast(Edge, self).locationAt((u1 + u0) / 2, mode="parameter"))
1923 else:
1924 rv.append(Location(self.Center()))
1925
1926 return rv
1927
1928 def filter(self, f: Callable[[Shape], bool]) -> Compound:
1929

Callers 2

moveMethod · 0.80
movedMethod · 0.80

Calls 8

ShapeTypeMethod · 0.95
CenterMethod · 0.95
LocationClass · 0.85
extendMethod · 0.80
uvBoundsMethod · 0.80
appendMethod · 0.80
locationAtMethod · 0.45
boundsMethod · 0.45

Tested by

no test coverage detected