Skip to content
Permalink
Browse files

Merge pull request #444 from looooo/python3-fixes

python3: neutral fixes
  • Loading branch information...
wwmayer committed Jan 15, 2017
2 parents 2f66ff6 + 42331bd commit adb9353d27fb23fa4627985804b3b5d4393db53d
Showing with 20 additions and 18 deletions.
  1. +14 −12 src/Mod/Part/BOPTools/GeneralFuseResult.py
  2. +6 −6 src/Mod/Part/BOPTools/ShapeMerge.py
@@ -110,12 +110,14 @@ def parse(self):
types.add(piece.ShapeType)

types_to_extract = types.intersection(nonaggregate_types)
extractor = lambda(sh):(
(sh.Vertexes if "Vertex" in types_to_extract else [])
+ (sh.Edges if "Edge" in types_to_extract else [])
+ (sh.Faces if "Face" in types_to_extract else [])
+ (sh.Solids if "Solid" in types_to_extract else [])
)

def extractor(sh):
return (
(sh.Vertexes if "Vertex" in types_to_extract else []) +
(sh.Edges if "Edge" in types_to_extract else []) +
(sh.Faces if "Face" in types_to_extract else []) +
(sh.Solids if "Solid" in types_to_extract else [])
)

aggregate_sources_indexes = [self.indexOfSource(sh) for sh in self.source_shapes if sh.ShapeType in aggregate_types]
aggregate_pieces = [sh for sh in self.pieces if sh.ShapeType in aggregate_types]
@@ -298,14 +300,14 @@ def makeSplitPieces(self, shape):
original shape."""

if shape.ShapeType == "Wire":
bit_extractor = lambda(sh): sh.Edges
joint_extractor = lambda(sh): sh.Vertexes
bit_extractor = lambda sh: sh.Edges
joint_extractor = lambda sh: sh.Vertexes
elif shape.ShapeType == "Shell":
bit_extractor = lambda(sh): sh.Faces
joint_extractor = lambda(sh): sh.Edges
bit_extractor = lambda sh: sh.Faces
joint_extractor = lambda sh: sh.Edges
elif shape.ShapeType == "CompSolid":
bit_extractor = lambda(sh): sh.Solids
joint_extractor = lambda(sh): sh.Faces
bit_extractor = lambda sh: sh.Solids
joint_extractor = lambda sh: sh.Faces
else:
#can't split the shape
return [shape]
@@ -50,9 +50,9 @@ def isConnected(shape1, shape2, shape_dim = -1):
if shape_dim == -1:
shape_dim = dimensionOfShapes([shape1, shape2])
extractor = {0: None,
1: (lambda(sh): sh.Vertexes),
2: (lambda(sh): sh.Edges),
3: (lambda(sh): sh.Faces) }[shape_dim]
1: (lambda sh: sh.Vertexes),
2: (lambda sh: sh.Edges),
3: (lambda sh: sh.Faces) }[shape_dim]
return len(findSharedElements([shape1, shape2], extractor))>0

def splitIntoGroupsBySharing(list_of_shapes, element_extractor, split_connections = []):
@@ -132,7 +132,7 @@ def mergeSolids(list_of_solids_compsolids, flag_single = False, split_connection
else:
if len(solids)==0:
return Part.Compound([])
groups = splitIntoGroupsBySharing(solids, lambda(sh): sh.Faces, split_connections)
groups = splitIntoGroupsBySharing(solids, lambda sh: sh.Faces, split_connections)
if bool_compsolid:
merged_solids = [Part.CompSolid(group) for group in groups]
else:
@@ -146,7 +146,7 @@ def mergeShells(list_of_faces_shells, flag_single = False, split_connections = [
if flag_single:
return Part.makeShell(faces)
else:
groups = splitIntoGroupsBySharing(faces, lambda(sh): sh.Edges, split_connections)
groups = splitIntoGroupsBySharing(faces, lambda sh: sh.Edges, split_connections)
return Part.makeCompound([Part.Shell(group) for group in groups])

def mergeWires(list_of_edges_wires, flag_single = False, split_connections = []):
@@ -156,7 +156,7 @@ def mergeWires(list_of_edges_wires, flag_single = False, split_connections = [])
if flag_single:
return Part.Wire(edges)
else:
groups = splitIntoGroupsBySharing(edges, lambda(sh): sh.Vertexes, split_connections)
groups = splitIntoGroupsBySharing(edges, lambda sh: sh.Vertexes, split_connections)
return Part.makeCompound([Part.Wire(Part.getSortedClusters(group)[0]) for group in groups])

def mergeVertices(list_of_vertices, flag_single = False, split_connections = []):

0 comments on commit adb9353

Please sign in to comment.
You can’t perform that action at this time.