Fixed the rotateAndCopy function by checking coincidence of vertices between wires. Still need to do some manual testing and add tests before merging.
This commit is contained in:
parent
1961c22268
commit
08c36a3947
|
@ -1261,7 +1261,7 @@ class Workplane(CQ):
|
|||
#attempt to consolidate wires together.
|
||||
consolidated = n.consolidateWires()
|
||||
|
||||
rotatedWires = self.plane.rotateShapes(consolidated.wires().vals(),matrix)
|
||||
rotatedWires = self.plane.rotateShapes(consolidated.wires().vals(), matrix)
|
||||
|
||||
for w in rotatedWires:
|
||||
consolidated.objects.append(w)
|
||||
|
|
|
@ -487,25 +487,30 @@ class Plane:
|
|||
for w in listOfShapes:
|
||||
mirrored = w.transformGeometry(rotationMatrix.wrapped)
|
||||
|
||||
# Make sure that our mirrored edges meet up and are ordered properly
|
||||
aEdges = w.wrapped.Edges
|
||||
aEdges.extend(mirrored.wrapped.Edges)
|
||||
comp = FreeCADPart.Compound(aEdges)
|
||||
mirroredWire = comp.connectEdgesToWires(False).Wires[0]
|
||||
# If the first vertex of the second wire is not coincident with the first or last vertices of the first wire
|
||||
# we have to fix the wire so that it will mirror correctly
|
||||
if (mirrored.wrapped.Vertexes[0].X == w.wrapped.Vertexes[0].X and mirrored.wrapped.Vertexes[0].Y == w.wrapped.Vertexes[0].Y and mirrored.wrapped.Vertexes[0].Z == w.wrapped.Vertexes[0].Z) or (mirrored.wrapped.Vertexes[0].X == w.wrapped.Vertexes[-1].X and mirrored.wrapped.Vertexes[0].Y == w.wrapped.Vertexes[-1].Y and mirrored.wrapped.Vertexes[0].Z == w.wrapped.Vertexes[-1].Z):
|
||||
resultWires.append(mirrored)
|
||||
else:
|
||||
# Make sure that our mirrored edges meet up and are ordered properly
|
||||
aEdges = w.wrapped.Edges
|
||||
aEdges.extend(mirrored.wrapped.Edges)
|
||||
comp = FreeCADPart.Compound(aEdges)
|
||||
mirroredWire = comp.connectEdgesToWires(False).Wires[0]
|
||||
|
||||
resultWires.append(cadquery.Shape.cast(mirroredWire))
|
||||
resultWires.append(cadquery.Shape.cast(mirroredWire))
|
||||
|
||||
return resultWires
|
||||
|
||||
|
||||
def _calcTransforms(self):
|
||||
"""
|
||||
Computes transformation martrices to convert betwene local and global coordinates
|
||||
Computes transformation martrices to convert between local and global coordinates
|
||||
"""
|
||||
#r is the forward transformation matrix from world to local coordinates
|
||||
#ok i will be really honest-- i cannot understand exactly why this works
|
||||
#something bout the order of the transaltion and the rotation.
|
||||
# the double-inverting is strange, and i dont understand it.
|
||||
#something bout the order of the translation and the rotation.
|
||||
# the double-inverting is strange, and I don't understand it.
|
||||
r = FreeCAD.Base.Matrix()
|
||||
|
||||
#forward transform must rotate and adjust for origin
|
||||
|
|
Loading…
Reference in New Issue
Block a user