Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicate additional breaking changes + docstring fixes #573

Merged
merged 4 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 10 additions & 21 deletions cadquery/cq.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _collectProperty(self, propName: str) -> List[CQObject]:
"""
Collects all of the values for propName,
for all items on the stack.
FreeCAD objects do not implement id correctly,
OCCT objects do not implement id correctly,
so hashCode is used to ensure we don't add the same
object multiple times.

Expand Down Expand Up @@ -334,7 +334,7 @@ def vals(self) -> List[CQObject]:
"""
get the values in the current list

:rtype: list of FreeCAD objects
:rtype: list of occ_impl objects
:returns: the values of the objects on the stack.

Contrast with :py:meth:`all`, which returns CQ objects for all of the items on the stack
Expand Down Expand Up @@ -403,10 +403,9 @@ def _getTagged(self, name: str) -> "Workplane":

def toOCC(self) -> Any:
"""
Directly returns the wrapped FreeCAD object to cut down on the amount of boiler plate code
needed when rendering a model in FreeCAD's 3D view.
:return: The wrapped FreeCAD object
:rtype A FreeCAD object or a SolidReference
Directly returns the wrapped OCCT object.
:return: The wrapped OCCT object
:rtype TopoDS_Shape or a subclass
"""

return self.val().wrapped
Expand Down Expand Up @@ -1030,7 +1029,7 @@ def mirror(
union: bool = False,
):
"""
Mirror a single CQ object. This operation is the same as in the FreeCAD PartWB's mirroring
Mirror a single CQ object.

:param mirrorPlane: the plane to mirror about
:type mirrorPlane: string, one of "XY", "YX", "XZ", "ZX", "YZ", "ZY" the planes
Expand Down Expand Up @@ -1967,9 +1966,6 @@ def mirrorY(self) -> "Workplane":
s = Workplane().lineTo(2,2).threePointArc((3,1),(2,0)).mirrorX().extrude(0.25)

Produces a flat, heart shaped object

Future Enhancements:
mirrorX().mirrorY() should work but doesnt, due to some FreeCAD weirdness
"""
# convert edges to a wire, if there are pending edges
n = self.wire(forConstruction=False)
Expand All @@ -1996,9 +1992,6 @@ def mirrorX(self) -> "Workplane":
and finally joined into a new wire

Typically used to make creating wires with symmetry easier.

Future Enhancements:
mirrorX().mirrorY() should work but doesnt, due to some FreeCAD weirdness
"""
# convert edges to a wire, if there are pending edges
n = self.wire(forConstruction=False)
Expand Down Expand Up @@ -2031,7 +2024,7 @@ def _addPendingWire(self, wire: Wire) -> None:
"""
Queue a Wire for later extrusion

Internal Processing Note. In FreeCAD, edges-->wires-->faces-->solids.
Internal Processing Note. In OCCT, edges-->wires-->faces-->solids.

but users do not normally care about these distinctions. Users 'think' in terms
of edges, and solids.
Expand Down Expand Up @@ -2060,10 +2053,6 @@ def consolidateWires(self) -> "Workplane":
Attempt to consolidate wires on the stack into a single.
If possible, a new object with the results are returned.
if not possible, the wires remain separated

FreeCAD has a bug in Part.Wire([]) which does not create wires/edges properly sometimes
Additionally, it has a bug where a profile composed of two wires ( rather than one )
also does not work properly. Together these are a real problem.
"""

w = self._consolidateWires()
Expand Down Expand Up @@ -2785,7 +2774,7 @@ def revolve(
# Make sure we account for users specifying angles larger than 360 degrees
angleDegrees %= 360.0

# Compensate for FreeCAD not assuming that a 0 degree revolve means a 360 degree revolve
# Compensate for OCCT not assuming that a 0 degree revolve means a 360 degree revolve
angleDegrees = 360.0 if angleDegrees == 0 else angleDegrees

# The default start point of the vector defining the axis of rotation will be the origin
Expand Down Expand Up @@ -3142,7 +3131,7 @@ def _extrude(

:param distance: distance to extrude
:param boolean both: extrude in both directions symmetrically
:return: a FreeCAD solid, suitable for boolean operations.
:return: OCCT solid(s), suitable for boolean operations.

This method is a utility method, primarily for plugin and internal use.
It is the basis for cutBlind,extrude,cutThruAll, and all similar methods.
Expand Down Expand Up @@ -3198,7 +3187,7 @@ def _revolve(
:type axisStart: tuple, a two tuple
:param axisEnd: the end point of the axis of rotation
:type axisEnd: tuple, a two tuple
:return: a FreeCAD solid, suitable for boolean operations.
:return: a OCCT solid(s), suitable for boolean operations.

This method is a utility method, primarily for plugin and internal use.
"""
Expand Down
2 changes: 1 addition & 1 deletion cadquery/occ_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ def combine(
:param cls:
:param listOfWires:
:param tol: default 1e-9
:return: Wire
:return: List[Wire]
"""

edges_in = TopTools_HSequenceOfShape()
Expand Down
3 changes: 3 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Master
------
### Breaking changes
* `centerOption` default value changed from `CenterOfMass` to `ProjectedOrigin` #532
* `Wire.combine` interface changed - now it returns `List[Wire]` #397
* `Workplane.each` interface changed - callable of the `Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape]], cadquery.occ_impl.shapes.Shape]` type is required #391
* `Workplane.eachpoint` interface changed - callable of the `Callable[[Union[cadquery.occ_impl.geom.Vector, cadquery.occ_impl.geom.Location, cadquery.occ_impl.shapes.Shape]], cadquery.occ_impl.shapes.Shape]` type is required #391

## Other changes

Expand Down