Symmetric extrude with respect to the workplane
Added additional parameter (both=Flase by default) to the extrude method which allows to symmetrically extrude with respect to he current workplane
This commit is contained in:
parent
bcea03d4d6
commit
32160d16a2
|
@ -1967,7 +1967,7 @@ class Workplane(CQ):
|
||||||
if clean: newS = newS.clean()
|
if clean: newS = newS.clean()
|
||||||
return newS
|
return newS
|
||||||
|
|
||||||
def extrude(self, distance, combine=True, clean=True):
|
def extrude(self, distance, combine=True, clean=True, both=False):
|
||||||
"""
|
"""
|
||||||
Use all un-extruded wires in the parent chain to create a prismatic solid.
|
Use all un-extruded wires in the parent chain to create a prismatic solid.
|
||||||
|
|
||||||
|
@ -1975,6 +1975,7 @@ class Workplane(CQ):
|
||||||
:type distance: float, negative means opposite the normal direction
|
:type distance: float, negative means opposite the normal direction
|
||||||
:param boolean combine: True to combine the resulting solid with parent solids if found.
|
:param boolean combine: True to combine the resulting solid with parent solids if found.
|
||||||
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
|
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
|
||||||
|
:param boolean both: extrude in both directions symmetrically
|
||||||
:return: a CQ object with the resulting solid selected.
|
:return: a CQ object with the resulting solid selected.
|
||||||
|
|
||||||
extrude always *adds* material to a part.
|
extrude always *adds* material to a part.
|
||||||
|
@ -1991,7 +1992,8 @@ class Workplane(CQ):
|
||||||
perpendicular to the plane extrude to surface. this is quite tricky since the surface
|
perpendicular to the plane extrude to surface. this is quite tricky since the surface
|
||||||
selected may not be planar
|
selected may not be planar
|
||||||
"""
|
"""
|
||||||
r = self._extrude(distance) # returns a Solid (or a compound if there were multiple)
|
r = self._extrude(distance,both=both) # returns a Solid (or a compound if there were multiple)
|
||||||
|
|
||||||
if combine:
|
if combine:
|
||||||
newS = self._combineWithBase(r)
|
newS = self._combineWithBase(r)
|
||||||
else:
|
else:
|
||||||
|
@ -2254,11 +2256,12 @@ class Workplane(CQ):
|
||||||
|
|
||||||
return self.newObject([r])
|
return self.newObject([r])
|
||||||
|
|
||||||
def _extrude(self, distance):
|
def _extrude(self, distance, both=False):
|
||||||
"""
|
"""
|
||||||
Make a prismatic solid from the existing set of pending wires.
|
Make a prismatic solid from the existing set of pending wires.
|
||||||
|
|
||||||
:param distance: distance to extrude
|
:param distance: distance to extrude
|
||||||
|
:param boolean both: extrude in both directions symmetrically
|
||||||
:return: a FreeCAD solid, suitable for boolean operations.
|
:return: a FreeCAD solid, suitable for boolean operations.
|
||||||
|
|
||||||
This method is a utility method, primarily for plugin and internal use.
|
This method is a utility method, primarily for plugin and internal use.
|
||||||
|
@ -2306,6 +2309,10 @@ class Workplane(CQ):
|
||||||
thisObj = Solid.extrudeLinear(ws[0], ws[1:], eDir)
|
thisObj = Solid.extrudeLinear(ws[0], ws[1:], eDir)
|
||||||
toFuse.append(thisObj)
|
toFuse.append(thisObj)
|
||||||
|
|
||||||
|
if both:
|
||||||
|
thisObj = Solid.extrudeLinear(ws[0], ws[1:], eDir.multiply(-1.))
|
||||||
|
toFuse.append(thisObj)
|
||||||
|
|
||||||
return Compound.makeCompound(toFuse)
|
return Compound.makeCompound(toFuse)
|
||||||
|
|
||||||
def _revolve(self, angleDegrees, axisStart, axisEnd):
|
def _revolve(self, angleDegrees, axisStart, axisEnd):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user