Returns a CQ object with all pending edges connected into a wire. All edges on the stack that can be combined will be combined into a single wire object, and other objects will remain on the stack unmodified. If there are no pending edges, this method will just retu
(self: T, forConstruction: bool = False)
| 2343 | return r |
| 2344 | |
| 2345 | def wire(self: T, forConstruction: bool = False) -> T: |
| 2346 | """ |
| 2347 | Returns a CQ object with all pending edges connected into a wire. |
| 2348 | |
| 2349 | All edges on the stack that can be combined will be combined into a single wire object, |
| 2350 | and other objects will remain on the stack unmodified. If there are no pending edges, |
| 2351 | this method will just return self. |
| 2352 | |
| 2353 | :param forConstruction: whether the wire should be used to make a solid, or if it is just |
| 2354 | for reference |
| 2355 | |
| 2356 | This method is primarily of use to plugin developers making utilities for 2D construction. |
| 2357 | This method should be called when a user operation implies that 2D construction is |
| 2358 | finished, and we are ready to begin working in 3d. |
| 2359 | |
| 2360 | SEE '2D construction concepts' for a more detailed explanation of how CadQuery handles |
| 2361 | edges, wires, etc. |
| 2362 | |
| 2363 | Any non edges will still remain. |
| 2364 | """ |
| 2365 | |
| 2366 | # do not consolidate if there are no free edges |
| 2367 | if len(self.ctx.pendingEdges) == 0: |
| 2368 | return self |
| 2369 | |
| 2370 | edges = self.ctx.popPendingEdges() |
| 2371 | w = Wire.assembleEdges(edges) |
| 2372 | if not forConstruction: |
| 2373 | self._addPendingWire(w) |
| 2374 | |
| 2375 | others = [e for e in self.objects if not isinstance(e, Edge)] |
| 2376 | |
| 2377 | return self.newObject(others + [w]) |
| 2378 | |
| 2379 | def each( |
| 2380 | self: T, |