Selects objects having the prescribed geometry type. Applicability: Faces: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE, REVOLUTION, EXTRUSION, OFFSET, OTHER Edges: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER, BSPLINE, OFFSET, OTHER You can use the stri
| 260 | |
| 261 | |
| 262 | class TypeSelector(Selector): |
| 263 | """ |
| 264 | Selects objects having the prescribed geometry type. |
| 265 | |
| 266 | Applicability: |
| 267 | Faces: PLANE, CYLINDER, CONE, SPHERE, TORUS, BEZIER, BSPLINE, REVOLUTION, EXTRUSION, OFFSET, OTHER |
| 268 | Edges: LINE, CIRCLE, ELLIPSE, HYPERBOLA, PARABOLA, BEZIER, BSPLINE, OFFSET, OTHER |
| 269 | |
| 270 | You can use the string selector syntax. For example this:: |
| 271 | |
| 272 | CQ(aCube).faces(TypeSelector("PLANE")) |
| 273 | |
| 274 | will select 6 faces, and is equivalent to:: |
| 275 | |
| 276 | CQ(aCube).faces("%PLANE") |
| 277 | |
| 278 | """ |
| 279 | |
| 280 | def __init__(self, typeString: str): |
| 281 | self.typeString = typeString.upper() |
| 282 | |
| 283 | def filter(self, objectList: Sequence[Shape]) -> List[Shape]: |
| 284 | r = [] |
| 285 | for o in objectList: |
| 286 | if o.geomType() == self.typeString: |
| 287 | r.append(o) |
| 288 | return r |
| 289 | |
| 290 | |
| 291 | class _NthSelector(Selector, ABC): |