Use all un-extruded wires in the parent chain to create a prismatic solid. :param until: The distance to extrude, normal to the workplane plane. When a float is passed, the extrusion extends this far and a negative value is in the opposite direction to the n
(
self: T,
until: Union[float, Literal["next", "last"], Face],
combine: CombineMode = True,
clean: bool = True,
both: bool = False,
taper: Optional[float] = None,
)
| 3028 | return self._combineWithBase(r, combine, clean) |
| 3029 | |
| 3030 | def extrude( |
| 3031 | self: T, |
| 3032 | until: Union[float, Literal["next", "last"], Face], |
| 3033 | combine: CombineMode = True, |
| 3034 | clean: bool = True, |
| 3035 | both: bool = False, |
| 3036 | taper: Optional[float] = None, |
| 3037 | ) -> T: |
| 3038 | """ |
| 3039 | Use all un-extruded wires in the parent chain to create a prismatic solid. |
| 3040 | |
| 3041 | :param until: The distance to extrude, normal to the workplane plane. When a float is |
| 3042 | passed, the extrusion extends this far and a negative value is in the opposite direction |
| 3043 | to the normal of the plane. The string "next" extrudes until the next face orthogonal to |
| 3044 | the wire normal. "last" extrudes to the last face. If a object of type Face is passed then |
| 3045 | the extrusion will extend until this face. **Note that the Workplane must contain a Solid for extruding to a given face.** |
| 3046 | :param combine: True or "a" to combine the resulting solid with parent solids if found, |
| 3047 | "cut" or "s" to remove the resulting solid from the parent solids if found. |
| 3048 | False to keep the resulting solid separated from the parent solids. |
| 3049 | :param clean: call :meth:`clean` afterwards to have a clean shape |
| 3050 | :param both: extrude in both directions symmetrically |
| 3051 | :param taper: angle for optional tapered extrusion |
| 3052 | :return: a CQ object with the resulting solid selected. |
| 3053 | |
| 3054 | The returned object is always a CQ object, and depends on whether combine is True, and |
| 3055 | whether a context solid is already defined: |
| 3056 | |
| 3057 | * if combine is False, the new value is pushed onto the stack. Note that when extruding |
| 3058 | until a specified face, combine can not be False |
| 3059 | * if combine is true, the value is combined with the context solid if it exists, |
| 3060 | and the resulting solid becomes the new context solid. |
| 3061 | """ |
| 3062 | |
| 3063 | # If subtractive mode is requested, use cutBlind |
| 3064 | if combine in ("cut", "s"): |
| 3065 | return self.cutBlind(until, clean, both, taper) |
| 3066 | |
| 3067 | # Handle `until` multiple values |
| 3068 | elif until in ("next", "last") and combine in (True, "a"): |
| 3069 | if until == "next": |
| 3070 | faceIndex = 0 |
| 3071 | elif until == "last": |
| 3072 | faceIndex = -1 |
| 3073 | |
| 3074 | r = self._extrude(None, both=both, taper=taper, upToFace=faceIndex) |
| 3075 | |
| 3076 | elif isinstance(until, Face) and combine: |
| 3077 | r = self._extrude(None, both=both, taper=taper, upToFace=until) |
| 3078 | |
| 3079 | elif isinstance(until, (int, float)): |
| 3080 | r = self._extrude(until, both=both, taper=taper, upToFace=None) |
| 3081 | |
| 3082 | elif isinstance(until, (str, Face)) and combine is False: |
| 3083 | raise ValueError( |
| 3084 | "`combine` can't be set to False when extruding until a face" |
| 3085 | ) |
| 3086 | |
| 3087 | else: |