From b2bb93a17839b2f07d55ef6e144bcc0eedc841b5 Mon Sep 17 00:00:00 2001 From: L-Nafaryus Date: Fri, 18 Jun 2021 23:38:59 +0500 Subject: [PATCH] Fix: strips part --- salomepl/bodyCentered.py | 48 ++++++++++++++++++++++++++++++++++++++++ salomepl/faceCentered.py | 48 ++++++++++++++++++++++++++++++++++++++++ salomepl/simple.py | 32 ++++++++++++++++++++++----- 3 files changed, 123 insertions(+), 5 deletions(-) diff --git a/salomepl/bodyCentered.py b/salomepl/bodyCentered.py index f1bb04e..c00929d 100644 --- a/salomepl/bodyCentered.py +++ b/salomepl/bodyCentered.py @@ -106,8 +106,10 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): grains = geompy.MakeFuseList(grains, False, False) grains = geompy.MakeScaleTransform(grains, oo, scale) + grainsOrigin = None if fillet: + grainsOrigin = grains grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -115,11 +117,28 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): ## shape = geompy.MakeCutList(cubic, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "bodyCenteredCubic") + stripsShape = None + + if fillet: + shapeOrigin = geompy.MakeCutList(cubic, [grainsOrigin]) + shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) + + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) + + stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) + strips = None + if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) + inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -145,6 +164,10 @@ def bodyCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): groups.append(inlet) groups.append(outlet) groups.extend(symetry) + + if fillet: + groups.append(strips) + wall = geompy.CutListOfGroups([sall], groups, theName = "wall") groups.append(wall) @@ -239,8 +262,10 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, grains = geompy.MakeFuseList(grains, False, False) grains = geompy.MakeScaleTransform(grains, oo, scale) + grainsOrigin = None if fillet: + grainsOrigin = grains grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -248,11 +273,29 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, ## shape = geompy.MakeCutList(hexagonPrism, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "bodyCenteredCubic") + stripsShape = None + + if fillet: + shapeOrigin = geompy.MakeCutList(hexagonPrism, [grainsOrigin]) + shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) + + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) + + stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) + strips = None + if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) + + inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -278,6 +321,11 @@ def bodyCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, groups.append(inlet) groups.append(outlet) groups.extend(symetry) + + if fillet: + groups.append(strips) + + wall = geompy.CutListOfGroups([sall], groups, theName = "wall") groups.append(wall) diff --git a/salomepl/faceCentered.py b/salomepl/faceCentered.py index d4e99fb..41ec235 100644 --- a/salomepl/faceCentered.py +++ b/salomepl/faceCentered.py @@ -105,8 +105,10 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): grains = geompy.MakeFuseList(grains, False, False) grains = geompy.MakeScaleTransform(grains, oo, scale) + grainsOrigin = None if fillet: + grainsOrigin = grains grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -114,11 +116,29 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): ## shape = geompy.MakeCutList(cubic, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "faceCenteredCubic") + stripsShape = None + + if fillet: + shapeOrigin = geompy.MakeCutList(cubic, [grainsOrigin]) + shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) + + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) + + stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) + strips = None + if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) + + inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -144,6 +164,10 @@ def faceCenteredCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): groups.append(inlet) groups.append(outlet) groups.extend(symetry) + + if fillet: + groups.append(strips) + wall = geompy.CutListOfGroups([sall], groups, theName = "wall") groups.append(wall) @@ -236,8 +260,10 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, grains = geompy.MakeFuseList(grains, False, False) grains = geompy.MakeScaleTransform(grains, oo, scale) + grainsOrigin = None if fillet: + grainsOrigin = grains grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -245,11 +271,29 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, ## shape = geompy.MakeCutList(hexagonPrism, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "faceCenteredCubic") + stripsShape = None + + if fillet: + shapeOrigin = geompy.MakeCutList(hexagonPrism, [grainsOrigin]) + shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) + + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) + + stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) + strips = None + if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) + + inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -275,6 +319,10 @@ def faceCenteredHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, groups.append(inlet) groups.append(outlet) groups.extend(symetry) + + if fillet: + groups.append(strips) + wall = geompy.CutListOfGroups([sall], groups, theName = "wall") groups.append(wall) diff --git a/salomepl/simple.py b/salomepl/simple.py index a708205..0a13516 100644 --- a/salomepl/simple.py +++ b/salomepl/simple.py @@ -107,7 +107,7 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "simpleCubic") stripsShape = None - if grainsOrigin: + if fillet: shapeOrigin = geompy.MakeCutList(cubic, [grainsOrigin]) shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) @@ -115,7 +115,6 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) - print(stripsShape) sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) @@ -123,9 +122,9 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) strips = None - if stripsShape: + if fillet: strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") - geompy.UnionIDs(strips, geompy.SubShapeAll( + geompy.UnionList(strips, geompy.SubShapeAll( geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") @@ -154,7 +153,7 @@ def simpleCubic(theta = 0.01, fillet = False, direction = [1, 0, 0]): groups.append(outlet) groups.extend(symetry) - if strips: + if fillet: groups.append(strips) wall = geompy.CutListOfGroups([sall], groups, theName = "wall") @@ -240,8 +239,10 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]): grains = geompy.MakeFuseList(grains, False, False) grains = geompy.MakeScaleTransform(grains, oo, scale) + grainsOrigin = None if fillet: + grainsOrigin = grains grains = geompy.MakeFilletAll(grains, filletradius * scale) ### @@ -249,11 +250,28 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]): ## shape = geompy.MakeCutList(hexagonPrism, [grains]) shape = geompy.MakeScaleTransform(shape, oo, 1 / scale, theName = "simpleCubic") + stripsShape = None + + if fillet: + shapeOrigin = geompy.MakeCutList(hexagonPrism, [grainsOrigin]) + shapeOrigin = geompy.MakeScaleTransform(shapeOrigin, oo, 1 / scale) + + shapeShell = geompy.ExtractShapes(shape, geompy.ShapeType["SHELL"], True) + shapeOriginShell = geompy.ExtractShapes(shapeOrigin, geompy.ShapeType["SHELL"], True) + + stripsShape = geompy.MakeCutList(shapeShell[0], shapeOriginShell) + sall = geompy.CreateGroup(shape, geompy.ShapeType["FACE"]) geompy.UnionIDs(sall, geompy.SubShapeAllIDs(shape, geompy.ShapeType["FACE"])) + strips = None + if fillet: + strips = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "strips") + geompy.UnionList(strips, geompy.SubShapeAll( + geompy.GetInPlace(shape, stripsShape, True), geompy.ShapeType["FACE"])) + inlet = geompy.CreateGroup(shape, geompy.ShapeType["FACE"], theName = "inlet") inletshape = geompy.MakeCutList(inletface, [grains]) inletshape = geompy.MakeScaleTransform(inletshape, oo, 1 / scale) @@ -279,6 +297,10 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]): groups.append(inlet) groups.append(outlet) groups.extend(symetry) + + if fillet: + groups.append(strips) + wall = geompy.CutListOfGroups([sall], groups, theName = "wall") groups.append(wall)