You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CombineMode=Union[bool, Literal["cut", "a", "s"]] # a : additive, s: subtractive
64
66
65
67
T=TypeVar("T", bound="Workplane")
66
68
"""A type variable used to make the return type of a method the same as the
@@ -2391,6 +2393,8 @@ def each(
2391
2393
self: T,
2392
2394
callback: Callable[[CQObject], Shape],
2393
2395
useLocalCoordinates: bool=False,
2396
+
combine: CombineMode=True,
2397
+
clean: bool=True,
2394
2398
) ->T:
2395
2399
"""
2396
2400
Runs the provided function on each value in the stack, and collects the return values into
@@ -2401,6 +2405,9 @@ def each(
2401
2405
:param callBackFunction: the function to call for each item on the current stack.
2402
2406
:param useLocalCoordinates: should values be converted from local coordinates first?
2403
2407
:type useLocalCoordinates: boolean
2408
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
2409
+
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
2410
+
2404
2411
2405
2412
The callback function must accept one argument, which is the item on the stack, and return
2406
2413
one object, which is collected. If the function returns None, nothing is added to the stack.
Same as each(), except each item on the stack is converted into a point before it
@@ -2454,6 +2462,9 @@ def eachpoint(
2454
2462
2455
2463
:param useLocalCoordinates: should points be in local or global coordinates
2456
2464
:type useLocalCoordinates: boolean
2465
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
2466
+
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
2467
+
2457
2468
2458
2469
The resulting object has a point on the stack for each object on the original stack.
2459
2470
Vertices and points remain a point. Faces, Wires, Solids, Edges, and Shells are converted
@@ -2489,7 +2500,7 @@ def eachpoint(
2489
2500
ifisinstance(r, Wire) andnotr.forConstruction:
2490
2501
self._addPendingWire(r)
2491
2502
2492
-
returnself.newObject(res)
2503
+
returnself._combineWithBase(res, combine, clean)
2493
2504
2494
2505
defrect(
2495
2506
self: T,
@@ -2948,7 +2959,7 @@ def twistExtrude(
2948
2959
self: T,
2949
2960
distance: float,
2950
2961
angleDegrees: float,
2951
-
combine: bool=True,
2962
+
combine: CombineMode=True,
2952
2963
clean: bool=True,
2953
2964
) ->T:
2954
2965
"""
@@ -2965,7 +2976,7 @@ def twistExtrude(
2965
2976
2966
2977
:param distance: the distance to extrude normal to the workplane
2967
2978
:param angle: angle (in degrees) to rotate through the extrusion
2968
-
:param boolean combine: True to combine the resulting solid with parent solids if found.
2979
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
2969
2980
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
2970
2981
:return: a CQ object with the resulting solid selected.
Use all un-extruded wires in the parent chain to create a prismatic solid.
3011
3016
3012
-
:param until: the distance to extrude, normal to the workplane plane
3013
3017
:param until: The distance to extrude, normal to the workplane plane. When a float is
3014
3018
passed, the extrusion extends this far and a negative value is in the opposite direction
3015
3019
to the normal of the plane. The string "next" extrudes until the next face orthogonal to
3016
3020
the wire normal. "last" extrudes to the last face. If a object of type Face is passed then
3017
-
the extrusion will extend until this face.
3018
-
:param boolean combine: True to combine the resulting solid with parent solids if found. (Cannot be set to False when `until` is not set as a float)
3021
+
the extrusion will extend until this face. **Note that the Workplane must contain a Solid for extruding to a given face.**
3022
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
3019
3023
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
3020
3024
:param boolean both: extrude in both directions symmetrically
3021
3025
:param float taper: angle for optional tapered extrusion
3022
3026
:return: a CQ object with the resulting solid selected.
3023
3027
3024
-
extrude always *adds* material to a part.
3025
-
3026
3028
The returned object is always a CQ object, and depends on whether combine is True, and
3027
3029
whether a context solid is already defined:
3028
3030
@@ -3031,14 +3033,19 @@ def extrude(
3031
3033
* if combine is true, the value is combined with the context solid if it exists,
3032
3034
and the resulting solid becomes the new context solid.
f"Do not know how to handle until argument of type {type(until)}"
3057
3064
)
3058
3065
3059
-
ifcombine:
3060
-
newS=self._combineWithBase(r)
3061
-
else:
3062
-
newS=self.newObject([r])
3063
-
ifclean:
3064
-
newS=newS.clean()
3065
-
returnnewS
3066
+
returnself._combineWithBase(r, combine, clean)
3066
3067
3067
3068
defrevolve(
3068
3069
self: T,
3069
3070
angleDegrees: float=360.0,
3070
3071
axisStart: Optional[VectorLike] =None,
3071
3072
axisEnd: Optional[VectorLike] =None,
3072
-
combine: bool=True,
3073
+
combine: CombineMode=True,
3073
3074
clean: bool=True,
3074
3075
) ->T:
3075
3076
"""
@@ -3081,8 +3082,7 @@ def revolve(
3081
3082
:type axisStart: tuple, a two tuple
3082
3083
:param axisEnd: the end point of the axis of rotation
3083
3084
:type axisEnd: tuple, a two tuple
3084
-
:param combine: True to combine the resulting solid with parent solids if found.
3085
-
:type combine: boolean, combine with parent solid
3085
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
3086
3086
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
3087
3087
:return: a CQ object with the resulting solid selected.
3088
3088
@@ -3126,13 +3126,8 @@ def revolve(
3126
3126
3127
3127
# returns a Solid (or a compound if there were multiple)
:param path: A wire along which the pending wires will be swept
3154
3149
:param boolean multiSection: False to create multiple swept from wires on the chain along path. True to create only one solid swept along path with shape following the list of wires on the chain
3155
-
:param boolean combine: True to combine the resulting solid with parent solids if found.
3150
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
3156
3151
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
3157
3152
:param transition: handling of profile orientation at C1 path discontinuities. Possible values are {'transformed','round', 'right'} (default: 'right').
3158
3153
:param normal: optional fixed normal for extrusion
@@ -3181,18 +3176,48 @@ def sweep(
3181
3176
auxSpine,
3182
3177
) # returns a Solid (or a compound if there were multiple)
3183
3178
3184
-
newS: T
3185
-
ifcombine:
3186
-
newS=self._combineWithBase(r)
3179
+
returnself._combineWithBase(r, combine, clean)
3180
+
3181
+
def_combineWithBase(
3182
+
self: T,
3183
+
obj: Union[Shape, Iterable[Shape]],
3184
+
mode: CombineMode=True,
3185
+
clean: bool=False,
3186
+
) ->T:
3187
+
"""
3188
+
Combines the provided object with the base solid, if one can be found.
3189
+
:param obj: The object to be combined with the context solid
3190
+
:param mode: The mode to combine with the base solid (True, False, "cut", "a" or "s")
3191
+
:return: a new object that represents the result of combining the base object with obj,
3192
+
or obj if one could not be found
3193
+
"""
3194
+
3195
+
ifmode:
3196
+
# since we are going to do something convert the iterable if needed
:param boolean ruled: When set to `True` connects each section linearly and without continuity
3522
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
3523
+
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
3524
+
3525
+
:return: a Workplane object containing the created loft
:param distance: the distance to extrude or cut, normal to the workplane plane
4138
4163
:type distance: float, negative means opposite the normal direction
4139
4164
:param cut: True to cut the resulting solid from the parent solids if found
4140
-
:param combine: True to combine the resulting solid with parent solids if found
4165
+
:param combine: True or "a" to combine the resulting solid with parent solids if found, "cut" or "s" to remove the resulting solid from the parent solids if found. False to keep the resulting solid separated from the parent solids.
4141
4166
:param clean: call :py:meth:`clean` afterwards to have a clean shape
0 commit comments