Collects all of the values for propName, for all items on the stack. One weird use case is that the stack could have a solid reference object on it. This is meant to be a reference to the most recently modified version of the context solid, whatever it is.
(self, propName: str)
| 225 | return self |
| 226 | |
| 227 | def _collectProperty(self, propName: str) -> List[CQObject]: |
| 228 | """ |
| 229 | Collects all of the values for propName, |
| 230 | for all items on the stack. |
| 231 | |
| 232 | One weird use case is that the stack could have a solid reference object |
| 233 | on it. This is meant to be a reference to the most recently modified version |
| 234 | of the context solid, whatever it is. |
| 235 | """ |
| 236 | rv: Dict[CQObject, Any] = {} # used as an ordered set |
| 237 | |
| 238 | for o in self.objects: |
| 239 | |
| 240 | # tricky-- if an object is a compound of solids, |
| 241 | # do not return all of the solids underneath-- typically |
| 242 | # then we'll keep joining to ourself |
| 243 | if ( |
| 244 | propName == "Solids" |
| 245 | and isinstance(o, Solid) |
| 246 | and o.ShapeType() == "Compound" |
| 247 | ): |
| 248 | for k in getattr(o, "Compounds")(): |
| 249 | rv[k] = None |
| 250 | else: |
| 251 | if hasattr(o, propName): |
| 252 | for k in getattr(o, propName)(): |
| 253 | rv[k] = None |
| 254 | |
| 255 | return list(rv.keys()) |
| 256 | |
| 257 | @overload |
| 258 | def split(self: T, keepTop: bool = False, keepBottom: bool = False) -> T: |
no test coverage detected