There are lots of kinds of filters, but for planes they are always based on the normal of the plane, and for edges on the tangent vector along the edge
(self, objectList: Sequence[Shape])
| 165 | return True |
| 166 | |
| 167 | def filter(self, objectList: Sequence[Shape]) -> List[Shape]: |
| 168 | """ |
| 169 | There are lots of kinds of filters, but for planes they are always |
| 170 | based on the normal of the plane, and for edges on the tangent vector |
| 171 | along the edge |
| 172 | """ |
| 173 | r = [] |
| 174 | for o in objectList: |
| 175 | # no really good way to avoid a switch here, edges and faces are simply different! |
| 176 | if o.ShapeType() == "Face" and o.geomType() == "PLANE": |
| 177 | # a face is only parallel to a direction if it is a plane, and |
| 178 | # its normal is parallel to the dir |
| 179 | test_vector = cast(FaceProtocol, o).normalAt(None) |
| 180 | elif o.ShapeType() == "Edge" and o.geomType() == "LINE": |
| 181 | # an edge is parallel to a direction if its underlying geometry is plane or line |
| 182 | test_vector = cast(Shape1DProtocol, o).tangentAt() |
| 183 | else: |
| 184 | continue |
| 185 | |
| 186 | if self.test(test_vector): |
| 187 | r.append(o) |
| 188 | |
| 189 | return r |
| 190 | |
| 191 | |
| 192 | class ParallelDirSelector(BaseDirSelector): |