def createAnodePlate(self): #create the plate rect1 = self.makeRectanglarMesh([0, 0], self.__widths[1] - self.__widths[0], self.__heights[1]) rect2 = self.makeRectanglarMesh([0, self.__heights[1]], self.__widths[1], self.__heights[0] - self.__heights[1]) #Need some more code: a1 = rect1.CreateEmptyGroup(SMESH.FACE, '1') nbAdd = a1.AddFrom(rect1.GetMesh()) a1.SetColor(SALOMEDS.Color(0, 0.666667, 1)) a2 = rect2.CreateEmptyGroup(SMESH.FACE, '1') nbAdd = a2.AddFrom(rect2.GetMesh()) a2.SetColor(SALOMEDS.Color(0, 0.666667, 1)) smesh.SetName(a1, str(1)) smesh.SetName(a2, str(1)) #create the void rect3 = self.makeRectanglarMesh( [self.__widths[1] - self.__widths[0], 0], self.__widths[0], self.__heights[1]) a3 = rect3.CreateEmptyGroup(SMESH.FACE, '2') nbAdd = a3.AddFrom(rect3.GetMesh()) a3.SetColor(SALOMEDS.Color(0, 0.666667, 1)) smesh.SetName(a3, str(2)) return [rect1, rect2, rect3]
def createGroupsOfPairs(self): if (self.nonOrthogonalityCheck): groupCounter = 0 for v in self.nonOrthogonalVolPairs: interimGroup = self.mesh.GetMesh().CreateGroup( SMESH.VOLUME, "non-orthogonal pair " + str(groupCounter)) color = SALOMEDS.Color(random.random(), random.random(), random.random()) interimGroup.Add([v[0], v[1]]) interimGroup.SetColor(color) groupCounter = groupCounter + 1 if (self.skewnessCheck): groupCounter = 0 for v in self.tooSkewVolPairs: interimGroup = self.mesh.GetMesh().CreateGroup( SMESH.VOLUME, "skew pair " + str(groupCounter)) color = SALOMEDS.Color(random.random(), random.random(), random.random()) interimGroup.Add([v[0], v[1]]) interimGroup.SetColor(color) groupCounter = groupCounter + 1
def createCathodePlate(self): rightCornerX = sum( self.__widths) - self.__widths[0] - self.__widths[-1] #create the plate print "right corner", rightCornerX print self.__widths[-2], self.__widths[-1] #print "op", [rightCornerX[0] ,0], -(self.__widths[1] -self.__widths[0]), self.__heights[0] rect1 = self.makeRectanglarMesh( [rightCornerX - (self.__widths[-2] - self.__widths[-1]), 0], self.__widths[-2] - self.__widths[-1], self.__heights[2]) rect2 = self.makeRectanglarMesh( [rightCornerX - self.__widths[-2], self.__heights[2]], self.__widths[-2], self.__heights[0] - self.__heights[2]) a1 = rect1.CreateEmptyGroup(SMESH.FACE, '11') nbAdd = a1.AddFrom(rect1.GetMesh()) a1.SetColor(SALOMEDS.Color(0, 0.666667, 1)) a2 = rect2.CreateEmptyGroup(SMESH.FACE, '11') nbAdd = a2.AddFrom(rect2.GetMesh()) a2.SetColor(SALOMEDS.Color(0, 0.666667, 1)) smesh.SetName(a1, str(1)) smesh.SetName(a2, str(1)) #create the void rect3 = self.makeRectanglarMesh([rightCornerX - self.__widths[-2], 0], self.__widths[-1], self.__heights[2]) a3 = rect3.CreateEmptyGroup(SMESH.FACE, '10') nbAdd = a3.AddFrom(rect3.GetMesh()) a3.SetColor(SALOMEDS.Color(0, 0.666667, 1)) smesh.SetName(a3, str(2)) return [rect1, rect2, rect3]
def shape2mesh(Pi, debug=1000000): import SMESH, SALOMEDS #debug=last index 1:activate vtkviewr #debug=digit 2:delete obj #debug=digit 4:restoreswitch salome geom module if int(str(debug)[len(str(debug)) - 4]) == 1: restoresalomeiparm(module='Mesh') from salome.smesh import smeshBuilder if int(str(debug)[len(str(debug)) - 2]) == 1: delobjregex(complaint="Shape*", s="delete", module='SMESH') smesh = smeshBuilder.New(salome.myStudy) Mesh_1 = smesh.Mesh(Pi.brepshapeobj) isDone = Mesh_1.Compute() # # from meshbuilder class and Mesh class instance # found among Modules.. NETGEN_2D = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_1D2D) #An instance of Mesh_Algorithm sub-class #"Creates triangle 2D algorithm for faces. #algo = canstants plugin NETGEN_2D.GetId() #? SGROUP = [Mesh_1.GroupOnGeom(group) for group in Pi.brepgroupobj] #Returns SMESH_GroupOnGeom #? for group in Pi.brepgroupobj: group.SetColor(SALOMEDS.Color(1, 0.666667, 0)) NETGEN_2D_Parameters = NETGEN_2D.Parameters() NETGEN_2D_Parameters.SetMaxSize(Pi.ng2D.NGParamSetMaxSize) #18 NETGEN_2D_Parameters.SetSecondOrder(Pi.ng2D.NGParamSetSecondOrder) NETGEN_2D_Parameters.SetOptimize(Pi.ng2D.NGParamSetOptimize) NETGEN_2D_Parameters.SetFineness(Pi.ng2D.NGParamSetFineness) #5 NETGEN_2D_Parameters.SetGrowthRate(Pi.ng2D.NGParamSetGrowthRate) NETGEN_2D_Parameters.SetNbSegPerEdge(Pi.ng2D.NGParamSetNbSegPerEdge) #15 NETGEN_2D_Parameters.SetNbSegPerRadius( Pi.ng2D.NGParamSetNbSegPerRadius) #2 NETGEN_2D_Parameters.SetMinSize(Pi.ng2D.NGParamSetMinSize) #52 NETGEN_2D_Parameters.SetUseSurfaceCurvature( Pi.ng2D.NGParamSetUseSurfaceCurvature) # 1 NETGEN_2D_Parameters.SetFuseEdges(Pi.ng2D.NGParamSetFuseEdges) #1 NETGEN_2D_Parameters.SetQuadAllowed(Pi.ng2D.NGParamSetQuadAllowed) # 0 isDone = Mesh_1.Compute() # sfaces(Groups) in object browser and visible in viewer: 2 cells be face if int(str(debug)[len(str(debug)) - 1]) == 1: displaysalomeplease(11121, 4, Pi.brepshapeobj.GetName()) Pi.meshobj = Mesh_1 print Mesh_1
def generate(self): if self.__widths[1] > 0: for el in self.createAnodePlate(): self.subMeshes.append(el) if self.__widths[-2] > 0: for el in self.createCathodePlate(): self.subMeshes.append(el) x = self.__widths[1] materialIDCount = 3 for w in self.__widths[2:-2]: rect = self.makeRectanglarMesh([x, 0], w, self.__heights[0]) a1 = rect.CreateEmptyGroup(SMESH.FACE, str(materialIDCount)) nbAdd = a1.AddFrom(rect.GetMesh()) a1.SetColor(SALOMEDS.Color(0, 0.666667, 1)) smesh.SetName(a1, str(materialIDCount)) self.subMeshes.append(rect) x += w materialIDCount += 1 self.mkCompound()
def proceed(): try: # selected Object selobj = selectGroupRef() # Is a group? isgroup = geompy.ShapeIdToType(selobj.GetType()) == 'GROUP' # The father of group father = geompy.GetMainShape(selobj) # Type of element elem = str(selobj.GetShapeType()) # Size props = geompy.BasicProperties(selobj) if elem == "EDGE": Sref = props[0] if elem == "FACE": Sref = props[1] if elem == "SOLID": Sref = props[2] # Location cm_ref = geompy.MakeCDG(selobj) coords_ref = geompy.PointCoordinates(cm_ref) # Normal (Element==Face) if elem == "FACE": vnorm_ref = geompy.GetNormal(selobj) else: vnorm_ref = None # Create container group group = list() # All Object elements of type elem elements = geompy.ExtractShapes(father, geompy.ShapeType[elem], True) # Create group Group_f = geompy.CreateGroup(father, geompy.ShapeType[elem]) # Options name_g = str(le_nam_g.text()) pr = eval(str(sb_tol.text())) except: QtGui.QMessageBox.critical(None, 'Error', "error 1", QtGui.QMessageBox.Abort) try: # Selected elements for the group whit the desired conditios for i in elements: props = geompy.BasicProperties(i) cm = geompy.MakeCDG(i) coords = geompy.PointCoordinates(cm) # Element i coordinates x = coords[0] y = coords[1] z = coords[2] # Element i size if elem == "EDGE": S = props[0] if elem == "FACE": S = props[1] if elem == "SOLID": S = props[2] # Element==Face i Normal if vnorm_ref == None: vnorm = None else: vnorm = geompy.GetNormal(i) angle = geompy.GetAngle(vnorm_ref, vnorm) # Comparations cond = list() if cb_size.isChecked(): cond.append(S < Sref * (1 + pr) and S > Sref * (1 - pr)) else: cond.append(True) if cb_locx.isChecked(): if coords_ref[0] >= 0: cond.append(x < coords_ref[0] * (1 + pr) and x > coords_ref[0] * (1 - pr)) else: cond.append(x > coords_ref[0] * (1 + pr) and x < coords_ref[0] * (1 - pr)) else: cond.append(True) if cb_locy.isChecked(): if coords_ref[1] >= 0: cond.append(y < coords_ref[1] * (1 + pr) and y > coords_ref[1] * (1 - pr)) else: cond.append(y > coords_ref[1] * (1 + pr) and y < coords_ref[1] * (1 - pr)) else: cond.append(True) if cb_locz.isChecked(): if coords_ref[2] >= 0: cond.append(z < coords_ref[2] * (1 + pr) and z > coords_ref[2] * (1 - pr)) else: cond.append(z > coords_ref[2] * (1 + pr) and z < coords_ref[2] * (1 - pr)) else: cond.append(True) if cb_norm.isChecked() and vnorm != None: cond.append(angle < 0.0 + 0.001 and angle > 0.0 - 0.001) else: cond.append(True) if cond[0] and cond[1] and cond[2] and cond[3] and cond[4]: ID = geompy.GetSubShapeID(father, i) group.append(ID) cond.append(cond) except: QtGui.QMessageBox.critical(None, 'Error', "error 2", QtGui.QMessageBox.Abort) # Add elements desired to Group try: geompy.UnionIDs(Group_f, group) # Set color of the group Group_f.SetColor(SALOMEDS.Color(1, 0, 0)) # Add group in hte gui resGroup = geompy.addToStudyInFather(father, Group_f, name_g) # View group gg = salome.ImportComponentGUI("GEOM") gg.createAndDisplayGO(resGroup) # Update Object Browser if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) except: QtGui.QMessageBox.critical(None, 'Error', "error 3", QtGui.QMessageBox.Abort) return 0.0
Propagation_of_1D_Hyp_1 = smesh.CreateHypothesis('Propagation') Regular_1D_1 = Mesh_1.Segment(geom=Edge_1) Number_of_Segments_2 = Regular_1D_1.NumberOfSegments("n_y", None, []) status = Mesh_1.AddHypothesis(Propagation_of_1D_Hyp, Edge_1) Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) Regular_1D_2 = Mesh_1.Segment() isDone = Mesh_1.Compute() Mesh_1.ConvertToQuadratic(0, Mesh_1, True) Group_1_0 = Mesh_1.GroupOnGeom(Edge_1, 'Edge_1', SMESH.EDGE) Group_1_0.SetName('Group_4_0') Group_3_0 = Mesh_1.GroupOnGeom(Edge_2, 'Group_1', SMESH.EDGE) Group_3_0.SetName('Group_1_0') Group_2_0 = Mesh_1.GroupOnGeom(Edge_4, 'Group_2_0', SMESH.EDGE) Group_4_0 = Mesh_1.GroupOnGeom(Edge_3, 'Group_3_0', SMESH.EDGE) Group_12_0 = Mesh_1.GroupOnGeom(Face_1, 'Group_12_0', SMESH.FACE) Group_4_0.SetColor(SALOMEDS.Color(1, 0.666667, 0)) Group_2_0.SetColor(SALOMEDS.Color(1, 0.666667, 0)) Group_3_0.SetColor(SALOMEDS.Color(1, 0.666667, 0)) Group_12_0.SetColor(SALOMEDS.Color(1, 0.666667, 0)) [Group_1_0, Group_3_0, Group_2_0, Group_4_0, Group_12_0] = Mesh_1.GetGroups() Group_1_0.SetColor(SALOMEDS.Color(1, 0.666667, 0)) Group_1_0.SetName('Group_1_0_n') Group_2_0.SetName('Group_3_0_n') Group_4_0.SetName('Group_4_0') Group_2_0.SetName('Group_2_0_n') Group_3_0.SetName('Group_3_0') Group_2_0.SetName('Group_2_0') Group_1_0.SetName('Group_1_0') Sub_mesh_1 = Regular_1D.GetSubMesh() Sub_mesh_2 = Regular_1D_1.GetSubMesh()
Maillage_1 = smesh.Mesh(Cadre) status = Maillage_1.AddHypothesis(Nb_Segments_1) status = Maillage_1.AddHypothesis(Regular_1D) isDone = Maillage_1.Compute() TOUT = Maillage_1.CreateEmptyGroup(SMESH.EDGE, 'TOUT') nbAdd = TOUT.Add([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140 ]) TOUT.SetColor(SALOMEDS.Color(0, 0.666667, 1)) Fourche_1 = Maillage_1.CreateEmptyGroup(SMESH.EDGE, 'Fourche') nbAdd = Fourche_1.Add([41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) Fourche_1.SetColor(SALOMEDS.Color(0, 0.666667, 1)) Direct = Maillage_1.CreateEmptyGroup(SMESH.EDGE, 'Direct') nbAdd = Direct.Add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) Direct.SetColor(SALOMEDS.Color(0, 0.666667, 1)) Arr = Maillage_1.CreateEmptyGroup(SMESH.EDGE, 'Arr') nbAdd = Arr.Add([ 52, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130 ]) Arr.SetColor(SALOMEDS.Color(0, 0.666667, 1))
def Project(): O = geompy.MakeVertex(0, 0, 0) O_id = geompy.addToStudy(O, "O") Vx = geompy.MakeVectorDXDYDZ(1, 0, 0) gst.addShapeToStudy(Vx, "Vx") Vy = geompy.MakeVectorDXDYDZ(0, 1, 0) geompy.addToStudy(Vy, "Vy") Vz = geompy.MakeVectorDXDYDZ(0, 0, 1) geompy.addToStudy(Vz, "Vz") # List of elements which are added to the study Liste = [] ListeV = [] L1 = [] L2 = [] List_id = [] ERREUR = False #gst.deleteShape(Obj) P0 = geompy.MakeVertex(0, 0, 0) geompy.addToStudy(P0, "P0 ") Vd2x_P0 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P0_vd2x = geompy.MakeTranslationVectorDistance(P0, Vd2x_P0, 100) Vd2x_P0 = geompy.MakeVector(P0, P0_vd2x) geompy.addToStudy(Vd2x_P0, "Vd2x_P0 ") P1 = geompy.MakeVertex(1000, 0, 0) geompy.addToStudy(P1, "P1 ") Vd2x_P1 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P1_vd2x = geompy.MakeTranslationVectorDistance(P1, Vd2x_P1, 100) Vd2x_P1 = geompy.MakeVector(P1, P1_vd2x) geompy.addToStudy(Vd2x_P1, "Vd2x_P1 ") P2 = geompy.MakeVertex(2000.0, 0.0, 0.0) geompy.addToStudy(P2, "P2 ") Vd2x_P2 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P2_vd2x = geompy.MakeTranslationVectorDistance(P2, Vd2x_P2, 100) Vd2x_P2 = geompy.MakeVector(P2, P2_vd2x) geompy.addToStudy(Vd2x_P2, "Vd2x_P2 ") P3 = geompy.MakeVertex(3000.0, 0.0, 0.0) geompy.addToStudy(P3, "P3 ") Vd2x_P3 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P3_vd2x = geompy.MakeTranslationVectorDistance(P3, Vd2x_P3, 100) Vd2x_P3 = geompy.MakeVector(P3, P3_vd2x) geompy.addToStudy(Vd2x_P3, "Vd2x_P3 ") P4 = geompy.MakeVertex(4000.0, 0.0, 0.0) geompy.addToStudy(P4, "P4 ") Vd2x_P4 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P4_vd2x = geompy.MakeTranslationVectorDistance(P4, Vd2x_P4, 100) Vd2x_P4 = geompy.MakeVector(P4, P4_vd2x) geompy.addToStudy(Vd2x_P4, "Vd2x_P4 ") P5 = geompy.MakeVertex(5000.0, 0.0, 0.0) geompy.addToStudy(P5, "P5 ") Vd2x_P5 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P5_vd2x = geompy.MakeTranslationVectorDistance(P5, Vd2x_P5, 100) Vd2x_P5 = geompy.MakeVector(P5, P5_vd2x) geompy.addToStudy(Vd2x_P5, "Vd2x_P5 ") P6 = geompy.MakeVertex(5850.0, 0.0, 0.0) geompy.addToStudy(P6, "P6 ") Vd2x_P6 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P6_vd2x = geompy.MakeTranslationVectorDistance(P6, Vd2x_P6, 100) Vd2x_P6 = geompy.MakeVector(P6, P6_vd2x) geompy.addToStudy(Vd2x_P6, "Vd2x_P6 ") P6_7_center = geompy.MakeVertex(5850.0, 150.0, 0.0) geompy.addToStudy(P6_7_center, "P6_7_center ") Vd2x_P6_7_center = geompy.MakeVectorDXDYDZ(1, 0, 0) P6_7_center_vd2x = geompy.MakeTranslationVectorDistance( P6_7_center, Vd2x_P6_7_center, 100) Vd2x_P6_7_center = geompy.MakeVector(P6_7_center, P6_7_center_vd2x) geompy.addToStudy(Vd2x_P6_7_center, "Vd2x_P6_7_center ") P7 = geompy.MakeVertex(6000.0, 150.0, 0.0) geompy.addToStudy(P7, "P7 ") Vd2x_P7 = geompy.MakeVectorDXDYDZ(6.123233995736766e-17, 1.0, 0.0) P7_vd2x = geompy.MakeTranslationVectorDistance(P7, Vd2x_P7, 100) Vd2x_P7 = geompy.MakeVector(P7, P7_vd2x) geompy.addToStudy(Vd2x_P7, "Vd2x_P7 ") P8 = geompy.MakeVertex(6000.0, 1150.0, 0.0) geompy.addToStudy(P8, "P8 ") Vd2x_P8 = geompy.MakeVectorDXDYDZ(6.123233995736766e-17, 1.0, 0.0) P8_vd2x = geompy.MakeTranslationVectorDistance(P8, Vd2x_P8, 100) Vd2x_P8 = geompy.MakeVector(P8, P8_vd2x) geompy.addToStudy(Vd2x_P8, "Vd2x_P8 ") try: print("Add V0") V0 = geompy.MakeVector(P0, P1) #Liste.append([P0,"P0"]) geompy.addToStudy(V0, "V0") Liste.append([V0, "V0"]) ListeV.append(V0) _C1 = geompy.MakeCircle(P0, V0, 35.0) _C2 = geompy.MakeCircle(P0, V0, 31.0) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V0M = smesh.Mesh(V0) Decoupage = V0M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V0M, 'V0') V0M.Compute() V0M.Group(P0) V0M.Group(P1) V0M.GroupOnGeom(V0) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P0, 105.0, 0, 0) Pnb = geompy.MakeVertexWithRef(P0, 70.0, 0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P0, -105.0, 0, 0) P2b = geompy.MakeVertexWithRef(P0, -70.0, 0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P0, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P0, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P0, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P0, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P0, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P0, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P0, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P0, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return try: print("Add V1") V1 = geompy.MakeVector(P1, P2) #Liste.append([P1,"P1"]) geompy.addToStudy(V1, "V1") Liste.append([V1, "V1"]) ListeV.append(V1) _C1 = geompy.MakeCircle(P1, V1, 35.0) _C2 = geompy.MakeCircle(P1, V1, 31.0) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V1M = smesh.Mesh(V1) Decoupage = V1M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V1M, 'V1') V1M.Compute() V1M.Group(P1) V1M.Group(P2) V1M.GroupOnGeom(V1) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P2, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P2, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P2, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P2, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P2, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P2, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P2, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P2, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return try: print("Add V2") V2 = geompy.MakeVector(P2, P3) #Liste.append([P2,"P2"]) geompy.addToStudy(V2, "V2") Liste.append([V2, "V2"]) ListeV.append(V2) _C1 = geompy.MakeCircle(P2, V2, 35.0) _C2 = geompy.MakeCircle(P2, V2, 31.0) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V2M = smesh.Mesh(V2) Decoupage = V2M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V2M, 'V2') V2M.Compute() V2M.Group(P2) V2M.Group(P3) V2M.GroupOnGeom(V2) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P2, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P2, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P2, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P2, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P2, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P2, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P2, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P2, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P3, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P3, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P3, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P3, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P3, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P3, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P3, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P3, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return try: print("Add V3") V3 = geompy.MakeVector(P3, P4) #Liste.append([P3,"P3"]) geompy.addToStudy(V3, "V3") Liste.append([V3, "V3"]) ListeV.append(V3) _C1 = geompy.MakeCircle(P3, V3, 35.0) _C2 = geompy.MakeCircle(P3, V3, 31.0) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V3M = smesh.Mesh(V3) Decoupage = V3M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V3M, 'V3') V3M.Compute() V3M.Group(P3) V3M.Group(P4) V3M.GroupOnGeom(V3) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P3, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P3, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P3, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P3, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P3, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P3, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P3, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P3, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P4, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P4, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P4, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P4, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P4, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P4, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P4, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P4, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return try: print("Add V4") V4 = geompy.MakeVector(P4, P5) #Liste.append([P4,"P4"]) geompy.addToStudy(V4, "V4") Liste.append([V4, "V4"]) ListeV.append(V4) _C1 = geompy.MakeCircle(P4, V4, 35.0) _C2 = geompy.MakeCircle(P4, V4, 31.0) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V4M = smesh.Mesh(V4) Decoupage = V4M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V4M, 'V4') V4M.Compute() V4M.Group(P4) V4M.Group(P5) V4M.GroupOnGeom(V4) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P4, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P4, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P4, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P4, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P4, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P4, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P4, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P4, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P5, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P5, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P5, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P5, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P5, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P5, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P5, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P5, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return try: print("Add V5") V5 = geompy.MakeVector(P5, P6) #Liste.append([P5,"P5"]) geompy.addToStudy(V5, "V5") Liste.append([V5, "V5"]) ListeV.append(V5) _C1 = geompy.MakeCircle(P5, V5, 35.0) _C2 = geompy.MakeCircle(P5, V5, 31.0) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V5M = smesh.Mesh(V5) Decoupage = V5M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V5M, 'V5') V5M.Compute() V5M.Group(P5) V5M.Group(P6) V5M.GroupOnGeom(V5) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P5, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P5, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P5, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P5, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P5, 0, 0, 105.0) Pnb = geompy.MakeVertexWithRef(P5, 0, 0, 70.0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P5, 0, 0, -105.0) P2b = geompy.MakeVertexWithRef(P5, 0, 0, -70.0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return try: print("Add V_Bent6 ") Liste = [] V_Bent6 = geompy.MakeArcCenter(P6_7_center, P6, P7) geompy.addToStudy(V_Bent6, "V_Bent6") Liste.append([V_Bent6, "V_Bent6"]) ListeV.append(V_Bent6) C1 = geompy.MakeCircle(P6, Vd2x_P6, 35.0) C2 = geompy.MakeCircle(P6, Vd2x_P6, 31.0) FaceTube = geompy.MakeFaceWires([C1, C2], 1) Liste.append([C1, "CercleExt"]) Liste.append([C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V_Bent6M = smesh.Mesh(V_Bent6) Decoupage = V_Bent6M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V_Bent6M, 'V_Bent6') V_Bent6M.Compute() V_Bent6M.GroupOnFilter( SMESH.NODE, 'P6', smesh.GetFilter(SMESH.NODE, SMESH.FT_LyingOnGeom, '=', P6)) V_Bent6M.GroupOnFilter( SMESH.NODE, 'P7', smesh.GetFilter(SMESH.NODE, SMESH.FT_LyingOnGeom, '=', P7)) V_Bent6M.GroupOnGeom(V_Bent6) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V7") V7 = geompy.MakeVector(P7, P8) #Liste.append([P7,"P7"]) geompy.addToStudy(V7, "V7") Liste.append([V7, "V7"]) ListeV.append(V7) _C1 = geompy.MakeCircle(P7, V7, 35.0) _C2 = geompy.MakeCircle(P7, V7, 31.0) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V7M = smesh.Mesh(V7) Decoupage = V7M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V7M, 'V7') V7M.Compute() V7M.Group(P7) V7M.Group(P8) V7M.GroupOnGeom(V7) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] # try: Radius = 35.0 Pna = geompy.MakeVertexWithRef(P8, 0, 105.0, 0) Pnb = geompy.MakeVertexWithRef(P8, 0, 70.0, 0) Vp = geompy.MakeVector(Pna, Pnb) Cone1 = geompy.MakeCone(Pna, Vp, Radius, 0, 2 * Radius) P2a = geompy.MakeVertexWithRef(P8, 0, -105.0, 0) P2b = geompy.MakeVertexWithRef(P8, 0, -70.0, 0) Vm = geompy.MakeVector(P2a, P2b) Cone2 = geompy.MakeCone(P2a, Vm, Radius, 0, 2 * Radius) B = geompy.MakeCompound([Cone1, Cone2]) B.SetColor(SALOMEDS.Color(1, 1, 0)) B_id = geompy.addToStudy(B, "B") gg.createAndDisplayGO(B_id) gg.setDisplayMode(B_id, 1) # for x in Liste: # geompy.addToStudyInFather(B,x[0],x[1]) # # except: # print("DDL wasnt visualized") # for x in Liste: # geompy.addToStudy(x[0],x[1]) # return #Creates the mesh compound if not (ERREUR): Completed_Mesh = smesh.Concatenate([ V0M.GetMesh(), V1M.GetMesh(), V2M.GetMesh(), V3M.GetMesh(), V4M.GetMesh(), V5M.GetMesh(), V_Bent6M.GetMesh(), V7M.GetMesh(), ], 1, 0, 1e-05) coincident_nodes = Completed_Mesh.FindCoincidentNodes(1e-05) Completed_Mesh.MergeNodes(coincident_nodes) equal_elements = Completed_Mesh.FindEqualElements(Completed_Mesh) Completed_Mesh.MergeElements(equal_elements) smesh.SetName(Completed_Mesh.GetMesh(), 'Completed_Mesh') if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0) time2 = time.time() dtime = time2 - time1 print("------------------------") print("Duration of construction:" + str(round(dtime, 2)) + "s")
smesh = smeshBuilder.New(theStudy) from salome.NETGENPlugin import NETGENPluginBuilder Mesh_1 = smesh.Mesh(Partition_1) NETGEN_2D3D = Mesh_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D) NETGEN_3D_Parameters = NETGEN_2D3D.Parameters() NETGEN_3D_Parameters.SetMaxSize(30) NETGEN_3D_Parameters.SetSecondOrder(0) NETGEN_3D_Parameters.SetOptimize(1) NETGEN_3D_Parameters.SetFineness(2) NETGEN_3D_Parameters.SetMinSize(10) baffle_1 = Mesh_1.GroupOnGeom(baffle, 'baffle', SMESH.FACE) walls_1 = Mesh_1.GroupOnGeom(walls, 'walls', SMESH.FACE) inlet_1 = Mesh_1.GroupOnGeom(inlet, 'inlet', SMESH.FACE) outlet_1 = Mesh_1.GroupOnGeom(outlet, 'outlet', SMESH.FACE) isDone = Mesh_1.Compute() baffle_1.SetColor(SALOMEDS.Color(1, 0.666667, 0)) ## set object names smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') smesh.SetName(NETGEN_2D3D.GetAlgorithm(), 'NETGEN_2D3D') smesh.SetName(NETGEN_3D_Parameters, 'NETGEN 3D Parameters') smesh.SetName(baffle_1, 'baffle') smesh.SetName(walls_1, 'walls') smesh.SetName(inlet_1, 'inlet') smesh.SetName(outlet_1, 'outlet') if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) import salomeToOpenFOAM as st st.debug = 0
[Sym1_mirrored_1, Sym1_mirrored_mirrored ] = Maillage_1.MirrorObject(Maillage_1, SMESH.AxisStruct(0, 0, 0, 0, -1, 0), SMESH.SMESH_MeshEditor.PLANE, True, True) # Merging Nodes mesh = Maillage_1 Tolerance = 1e-5 GroupsOfNodes = mesh.FindCoincidentNodes(Tolerance) mesh.MergeNodes(GroupsOfNodes) # Merging Elements equal_elements = Maillage_1.FindEqualElements(Maillage_1) Maillage_1.MergeElements(equal_elements) Sym = Maillage_1.GetMesh().UnionListOfGroups( [Sym1_1, Sym1_mirrored, Sym1_mirrored_1, Sym1_mirrored_mirrored], 'Sym') Sym.SetColor(SALOMEDS.Color(1, 0, 0)) # Passage au quadratique Maillage_1.ConvertToQuadratic(1) ## Set names of Mesh objects smesh.SetName(NETGEN_2D3D.GetAlgorithm(), 'NETGEN_2D3D') smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') smesh.SetName(Local_Length_1, 'Local Length_1') smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') smesh.SetName(NETGEN_3D_Parameters, 'NETGEN 3D Parameters') smesh.SetName(Nb_Segments_2, 'Nb. Segments_2') smesh.SetName(Maillage_1.GetMesh(), 'Maillage_1') smesh.SetName(Sous_maillage_3, 'Sous-maillage_3')
listSubShapeIDs = geompy.SubShapeAllIDs(Cut_1, geompy.ShapeType["FACE"]) listSubShapeIDs = geompy.SubShapeAllIDs(Cut_1, geompy.ShapeType["FACE"]) listSubShapeIDs = geompy.SubShapeAllIDs(Cut_1, geompy.ShapeType["FACE"]) listSubShapeIDs = geompy.SubShapeAllIDs(Cut_1, geompy.ShapeType["FACE"]) Electrode1 = geompy.CreateGroup(Cut_1, geompy.ShapeType["EDGE"]) geompy.UnionIDs(Electrode1, [8, 25, 27, 29]) listSameIDs = geompy.GetSameIDs(Cut_1, geomObj_3) listSameIDs = geompy.GetSameIDs(Cut_1, geomObj_14) listSameIDs = geompy.GetSameIDs(Cut_1, geomObj_7) Electrode2 = geompy.CreateGroup(Cut_1, geompy.ShapeType["EDGE"]) geompy.UnionIDs(Electrode2, [17, 19, 21, 36]) Outer = geompy.CreateGroup(Cut_1, geompy.ShapeType["EDGE"]) geompy.UnionIDs(Outer, [5, 10, 14, 23, 33]) Medium = geompy.CreateGroup(Cut_1, geompy.ShapeType["FACE"]) geompy.UnionIDs(Medium, [3, 12, 31]) Cut_1.SetColor(SALOMEDS.Color(0, 0, 0)) geompy.addToStudy(O, 'O') geompy.addToStudy(OX, 'OX') geompy.addToStudy(OY, 'OY') geompy.addToStudy(OZ, 'OZ') geompy.addToStudy(Disk_1, 'Disk_1') geompy.addToStudy(Face_1, 'Face_1') geompy.addToStudy(Translation_1, 'Translation_1') geompy.addToStudy(Cut_1, 'Cut_1') geompy.addToStudyInFather(Cut_1, Electrode1, 'Electrode1') geompy.addToStudyInFather(Cut_1, Electrode2, 'Electrode2') geompy.addToStudyInFather(Cut_1, Outer, 'Outer') geompy.addToStudyInFather(Cut_1, Medium, 'Medium') ### ### SMESH component
import smesh, SMESH, SALOMEDS smesh.SetCurrentStudy(theStudy) import StdMeshers Maillage_1 = smesh.Mesh(Assemblage_1) Regular_1D = Maillage_1.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(1) Nb_Segments_1.SetDistrType(0) isDone = Maillage_1.Compute() TOUT = Maillage_1.CreateEmptyGroup(SMESH.EDGE, 'TOUT') nbAdd = TOUT.AddFrom(Maillage_1.GetMesh()) Group_1 = Maillage_1.CreateEmptyGroup(SMESH.NODE, 'Group_1') nbAdd = Group_1.Add([6]) Group_1.SetColor(SALOMEDS.Color(1, 0.666667, 0)) Group_2 = Maillage_1.CreateEmptyGroup(SMESH.NODE, 'Group_2') nbAdd = Group_2.Add([5]) Group_2.SetColor(SALOMEDS.Color(1, 0.666667, 0)) Group_2 = Maillage_1.CreateEmptyGroup(SMESH.NODE, 'Group_3') nbAdd = Group_2.Add([1]) Group_2.SetColor(SALOMEDS.Color(1, 0.666667, 0)) ## set object names smesh.SetName(Maillage_1.GetMesh(), 'Maillage_1') smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') smesh.SetName(TOUT, 'TOUT') smesh.SetName(Group_1, 'Group_1') smesh.SetName(Group_2, 'Group_2')
vectYx, vectYy, vectYz ] def rejectCallback(): """Action called when click on Cancel""" for i in range(len(LIST_SHAPE_NAME)): if LIST_SHAPE_NAME[i] == DEFAULT_SHAPE_NAME: dialogWithApply.reject() if previewShapeEntry[i] is not None: deletePreviewShape(LIST_SHAPE_NAME, activeStudy, previewShapeEntry, DEFAULT_SHAPE_NAME) import SALOMEDS PREVIEW_COLOR = SALOMEDS.Color(1, 0.6, 1) # pink def applyCallback(): """Action called when click on Apply""" for i in range(len(LIST_SHAPE_NAME)): if LIST_SHAPE_NAME[i] == DEFAULT_SHAPE_NAME: # We first have to destroy the currently displayed preview shape. if previewShapeEntry[i] is not None: deletePreviewShape(LIST_SHAPE_NAME, activeStudy, previewShapeEntry, DEFAULT_SHAPE_NAME) # Then we can create the new shape with the new parameter values rmaj, rmin, centerx, centery, centerz, vectXx, vectXy, vectXz, vectYx, vectYy, vectYz = dialogWithApply.getData( )
True) n_shells = len(list_shell) if selCount == 2: for i in range(0, n_shells): isOk, res1, res2 = geompy.FastIntersect(list_shell[i], selobj2, 0) if isOk > 0: common1 = geompy.MakeCommon(selobj2, list_shell[i]) props = geompy.BasicProperties(common1) area_com = props[1] if area_com > 0: if External_Volume_Result == True: volume = geompy.MakeCompound([list_shell[i]]) geompy.addToStudy(volume, 'InternalVolume') gg = salome.ImportComponentGUI("GEOM") volume.SetColor(SALOMEDS.Color(1, 0, 0)) else: Group_ob = geompy.CreateGroup(selobj, geompy.ShapeType["FACE"]) list_faces = geompy.ExtractShapes(list_shell[i], geompy.ShapeType["FACE"], True) nlist = len(list_faces) for i in range(0, nlist): try: ID = geompy.GetSubShapeID(selobj, list_faces[i]) geompy.AddObject(Group_ob, ID) except: pass resGroup = geompy.addToStudyInFather( selobj, Group_ob, 'InternalSurface')
SMESH.FT_Undefined, topSurface[tileId[i][0]], SMESH.FT_Undefined, SMESH.FT_LogicalOR), smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, SMESH.FT_Undefined, topSurface[tileId[i][1]], SMESH.FT_Undefined, SMESH.FT_LogicalOR), smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, SMESH.FT_Undefined, topSurface[tileId[i][2]], SMESH.FT_Undefined, SMESH.FT_LogicalOR), smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, SMESH.FT_Undefined, topSurface[tileId[i][3]]) ] aFilter = smesh.GetFilterFromCriteria(aCriteria) aFilter.SetMesh(hexMesh.GetMesh()) burnerTile = hexMesh.GroupOnFilter(SMESH.FACE, 'burnerTile_' + str(i + 1), aFilter) burnerTile.SetColor(SALOMEDS.Color(1, 0, 0)) # --------- Set name of Mesh object smesh.SetName(burnerTile, 'burnerTile_' + str(i + 1)) # Group Burners type A #---------------- burnerAId = [ [5 + 39 * i, 8 + 39 * i, 9 + 39 * i, 10 + 39 * i, 12 + 39 * i] for i in range(3) ] + [[15 + 39 * i, 18 + 39 * i, 19 + 39 * i, 20 + 39 * i, 23 + 39 * i] for i in range(3) ] + [[26 + 39 * i, 28 + 39 * i, 29 + 39 * i, 30 + 39 * i, 33 + 39 * i] for i in range(3)] for i in range(9): aCriteria = [ smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom,
sk = geompy.Sketcher2D() sk.addPoint(0.000000, 0.000000) sk.addSegmentAbsolute(1.000000, 0.000000) sk.addSegmentAbsolute(0.000000, 1.000000) sk.close() geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0) Sketch_1 = sk.wire(geomObj_1) Triangle_src = geompy.MakeFaceWires([Sketch_1], 1) Triangle_tgt = geompy.MakeRotation(Triangle_src, OY, -math.pi / 4.) geompy.TranslateDXDYDZ(Triangle_tgt, 0, 0, 0.01) Bnd_box = geompy.MakeBoundingBox(Triangle_tgt) geompy.Scale(Bnd_box, geompy.MakeCDG(Bnd_box), 1.1) Bnd_box.SetColor(SALOMEDS.Color(1, 0, 0)) Triangle_src.SetColor(SALOMEDS.Color(0, 0.333333, 1)) Triangle_tgt.SetColor(SALOMEDS.Color(0, 1, 0.498039)) geompy.addToStudy(Triangle_src, 'Triangle_src') geompy.addToStudy(Triangle_tgt, 'Triangle_tgt') geompy.addToStudy(Bnd_box, 'Bnd_box') ### Store presentation parameters of displayed objects import iparameters ipar = iparameters.IParameters( theStudy.GetModuleParameters("Interface Applicative", "GEOM", 1)) #Set up entries: # set up entry GEOM_6 (Triangle_src) parameters objId = geompy.getObjectID(Triangle_src)
def Project(): O = geompy.MakeVertex(0, 0, 0) O_id = geompy.addToStudy(O, "O") Vx = geompy.MakeVectorDXDYDZ(1, 0, 0) gst.addShapeToStudy(Vx, "Vx") Vy = geompy.MakeVectorDXDYDZ(0, 1, 0) geompy.addToStudy(Vy, "Vy") Vz = geompy.MakeVectorDXDYDZ(0, 0, 1) geompy.addToStudy(Vz, "Vz") # List of elements which are added to the study Liste = [] ListeV = [] L1 = [] L2 = [] List_id = [] ERREUR = False #gst.deleteShape(Obj) P0 = geompy.MakeVertex(0, 0, 0) geompy.addToStudy(P0, "P0 ") Vd2x_P0 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P0_vd2x = geompy.MakeTranslationVectorDistance(P0, Vd2x_P0, 100) Vd2x_P0 = geompy.MakeVector(P0, P0_vd2x) geompy.addToStudy(Vd2x_P0, "Vd2x_P0 ") P1 = geompy.MakeVertex(850.0, 0.0, 0.0) geompy.addToStudy(P1, "P1 ") Vd2x_P1 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P1_vd2x = geompy.MakeTranslationVectorDistance(P1, Vd2x_P1, 100) Vd2x_P1 = geompy.MakeVector(P1, P1_vd2x) geompy.addToStudy(Vd2x_P1, "Vd2x_P1 ") P1_2_center = geompy.MakeVertex(850.0, 9.184850993605149e-15, 150.0) geompy.addToStudy(P1_2_center, "P1_2_center ") Vd2x_P1_2_center = geompy.MakeVectorDXDYDZ(1, 0, 0) P1_2_center_vd2x = geompy.MakeTranslationVectorDistance( P1_2_center, Vd2x_P1_2_center, 100) Vd2x_P1_2_center = geompy.MakeVector(P1_2_center, P1_2_center_vd2x) geompy.addToStudy(Vd2x_P1_2_center, "Vd2x_P1_2_center ") P2 = geompy.MakeVertex(1000.0, 9.184850993605149e-15, 150.0) geompy.addToStudy(P2, "P2 ") Vd2x_P2 = geompy.MakeVectorDXDYDZ(6.123233995736766e-17, 6.123233995736766e-17, 1.0) P2_vd2x = geompy.MakeTranslationVectorDistance(P2, Vd2x_P2, 100) Vd2x_P2 = geompy.MakeVector(P2, P2_vd2x) geompy.addToStudy(Vd2x_P2, "Vd2x_P2 ") P3 = geompy.MakeVertex(1000.0000000000001, 7.041719095097281e-14, 1150.0) geompy.addToStudy(P3, "P3 ") Vd2x_P3 = geompy.MakeVectorDXDYDZ(6.123233995736766e-17, 6.123233995736766e-17, 1.0) P3_vd2x = geompy.MakeTranslationVectorDistance(P3, Vd2x_P3, 100) Vd2x_P3 = geompy.MakeVector(P3, P3_vd2x) geompy.addToStudy(Vd2x_P3, "Vd2x_P3 ") P4 = geompy.MakeVertex(0, 1000, 0) geompy.addToStudy(P4, "P4 ") Vd2x_P4 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P4_vd2x = geompy.MakeTranslationVectorDistance(P4, Vd2x_P4, 100) Vd2x_P4 = geompy.MakeVector(P4, P4_vd2x) geompy.addToStudy(Vd2x_P4, "Vd2x_P4 ") P5 = geompy.MakeVertex(850.0, 1000.0, 0.0) geompy.addToStudy(P5, "P5 ") Vd2x_P5 = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0) P5_vd2x = geompy.MakeTranslationVectorDistance(P5, Vd2x_P5, 100) Vd2x_P5 = geompy.MakeVector(P5, P5_vd2x) geompy.addToStudy(Vd2x_P5, "Vd2x_P5 ") P5_6_center = geompy.MakeVertex(850.0, 1000.0, 150.0) geompy.addToStudy(P5_6_center, "P5_6_center ") Vd2x_P5_6_center = geompy.MakeVectorDXDYDZ(1, 0, 0) P5_6_center_vd2x = geompy.MakeTranslationVectorDistance( P5_6_center, Vd2x_P5_6_center, 100) Vd2x_P5_6_center = geompy.MakeVector(P5_6_center, P5_6_center_vd2x) geompy.addToStudy(Vd2x_P5_6_center, "Vd2x_P5_6_center ") P6 = geompy.MakeVertex(1000.0, 1000.0, 150.0) geompy.addToStudy(P6, "P6 ") Vd2x_P6 = geompy.MakeVectorDXDYDZ(6.123233995736766e-17, 6.123233995736766e-17, 1.0) P6_vd2x = geompy.MakeTranslationVectorDistance(P6, Vd2x_P6, 100) Vd2x_P6 = geompy.MakeVector(P6, P6_vd2x) geompy.addToStudy(Vd2x_P6, "Vd2x_P6 ") P7 = geompy.MakeVertex(1000.0000000000001, 1000.0000000000001, 1150.0) geompy.addToStudy(P7, "P7 ") Vd2x_P7 = geompy.MakeVectorDXDYDZ(6.123233995736766e-17, 6.123233995736766e-17, 1.0) P7_vd2x = geompy.MakeTranslationVectorDistance(P7, Vd2x_P7, 100) Vd2x_P7 = geompy.MakeVector(P7, P7_vd2x) geompy.addToStudy(Vd2x_P7, "Vd2x_P7 ") try: print("Add V0") V0 = geompy.MakeVector(P0, P1) #Liste.append([P0,"P0"]) geompy.addToStudy(V0, "V0") Liste.append([V0, "V0"]) ListeV.append(V0) _C1 = geompy.MakeCircle(P0, V0, 35) _C2 = geompy.MakeCircle(P0, V0, 31) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V0M = smesh.Mesh(V0) Decoupage = V0M.Segment() Decoupage.NumberOfSegments(8) Quadratic_Mesh = Decoupage.QuadraticMesh() smesh.SetName(V0M, 'V0') V0M.Compute() V0M.Group(P0) V0M.Group(P1) V0M.GroupOnGeom(V0) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V_Bent1 ") Liste = [] V_Bent1 = geompy.MakeArcCenter(P1_2_center, P1, P2) geompy.addToStudy(V_Bent1, "V_Bent1") Liste.append([V_Bent1, "V_Bent1"]) ListeV.append(V_Bent1) C1 = geompy.MakeCircle(P1, Vd2x_P1, 35) C2 = geompy.MakeCircle(P1, Vd2x_P1, 31) FaceTube = geompy.MakeFaceWires([C1, C2], 1) Liste.append([C1, "CercleExt"]) Liste.append([C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V_Bent1M = smesh.Mesh(V_Bent1) Decoupage = V_Bent1M.Segment() Decoupage.NumberOfSegments(8) Quadratic_Mesh = Decoupage.QuadraticMesh() smesh.SetName(V_Bent1M, 'V_Bent1') V_Bent1M.Compute() V_Bent1M.GroupOnFilter( SMESH.NODE, 'P1', smesh.GetFilter(SMESH.NODE, SMESH.FT_LyingOnGeom, '=', P1)) V_Bent1M.GroupOnFilter( SMESH.NODE, 'P2', smesh.GetFilter(SMESH.NODE, SMESH.FT_LyingOnGeom, '=', P2)) V_Bent1M.GroupOnGeom(V_Bent1) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V2") V2 = geompy.MakeVector(P2, P3) #Liste.append([P2,"P2"]) geompy.addToStudy(V2, "V2") Liste.append([V2, "V2"]) ListeV.append(V2) _C1 = geompy.MakeCircle(P2, V2, 35) _C2 = geompy.MakeCircle(P2, V2, 31) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V2M = smesh.Mesh(V2) Decoupage = V2M.Segment() Decoupage.NumberOfSegments(8) Quadratic_Mesh = Decoupage.QuadraticMesh() smesh.SetName(V2M, 'V2') V2M.Compute() V2M.Group(P2) V2M.Group(P3) V2M.GroupOnGeom(V2) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V3") V3 = geompy.MakeVector(P4, P5) #Liste.append([P4,"P4"]) geompy.addToStudy(V3, "V3") Liste.append([V3, "V3"]) ListeV.append(V3) _C1 = geompy.MakeCircle(P4, V3, 35) _C2 = geompy.MakeCircle(P4, V3, 31) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V3M = smesh.Mesh(V3) Decoupage = V3M.Segment() Decoupage.NumberOfSegments(8) Quadratic_Mesh = Decoupage.QuadraticMesh() smesh.SetName(V3M, 'V3') V3M.Compute() V3M.Group(P4) V3M.Group(P5) V3M.GroupOnGeom(V3) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V_Bent4 ") Liste = [] V_Bent4 = geompy.MakeArcCenter(P5_6_center, P5, P6) geompy.addToStudy(V_Bent4, "V_Bent4") Liste.append([V_Bent4, "V_Bent4"]) ListeV.append(V_Bent4) C1 = geompy.MakeCircle(P5, Vd2x_P5, 35) C2 = geompy.MakeCircle(P5, Vd2x_P5, 31) FaceTube = geompy.MakeFaceWires([C1, C2], 1) Liste.append([C1, "CercleExt"]) Liste.append([C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V_Bent4M = smesh.Mesh(V_Bent4) Decoupage = V_Bent4M.Segment() Decoupage.NumberOfSegments(8) Quadratic_Mesh = Decoupage.QuadraticMesh() smesh.SetName(V_Bent4M, 'V_Bent4') V_Bent4M.Compute() V_Bent4M.GroupOnFilter( SMESH.NODE, 'P5', smesh.GetFilter(SMESH.NODE, SMESH.FT_LyingOnGeom, '=', P5)) V_Bent4M.GroupOnFilter( SMESH.NODE, 'P6', smesh.GetFilter(SMESH.NODE, SMESH.FT_LyingOnGeom, '=', P6)) V_Bent4M.GroupOnGeom(V_Bent4) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V5") V5 = geompy.MakeVector(P6, P7) #Liste.append([P6,"P6"]) geompy.addToStudy(V5, "V5") Liste.append([V5, "V5"]) ListeV.append(V5) _C1 = geompy.MakeCircle(P6, V5, 35) _C2 = geompy.MakeCircle(P6, V5, 31) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V5M = smesh.Mesh(V5) Decoupage = V5M.Segment() Decoupage.NumberOfSegments(8) Quadratic_Mesh = Decoupage.QuadraticMesh() smesh.SetName(V5M, 'V5') V5M.Compute() V5M.Group(P6) V5M.Group(P7) V5M.GroupOnGeom(V5) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] #Creates the mesh compound if not (ERREUR): Completed_Mesh = smesh.Concatenate([ V0M.GetMesh(), V_Bent1M.GetMesh(), V2M.GetMesh(), V3M.GetMesh(), V_Bent4M.GetMesh(), V5M.GetMesh(), ], 1, 0, 1e-05) coincident_nodes = Completed_Mesh.FindCoincidentNodes(1e-05) Completed_Mesh.MergeNodes(coincident_nodes) equal_elements = Completed_Mesh.FindEqualElements(Completed_Mesh) Completed_Mesh.MergeElements(equal_elements) smesh.SetName(Completed_Mesh.GetMesh(), 'Completed_Mesh') if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0) time2 = time.time() dtime = time2 - time1 print("------------------------") print("Duration of construction:" + str(round(dtime, 2)) + "s")
[shell['case']['solid'], solid], True, True) #shell['case']['solid'] = geompy.MakeCutList(shell['case']['solid'],\ #[shell['wp']['solid']],True) for p in profiles: solid_id = geompy.addToStudy(shell[p]['solid'], '{}_solid'.format(p)) gg.createAndDisplayGO(solid_id) mag_part = geompy.MakeCompound([shell['wp']['solid'], shell['case']['solid']]) mag_part_id = geompy.addToStudy(mag_part, 'TF') gg.createAndDisplayGO(mag_part_id) TF_cage = geompy.MultiRotate1DNbTimes(mag_part, None, nTF) c = color[0] TF_cage.SetColor(SALOMEDS.Color(c[0], c[1], c[2])) rotate_id = geompy.addToStudy(TF_cage, 'TF_cage') gg.createAndDisplayGO(rotate_id) coil_set = [TF_cage] for i in range(len(pf)): c = color[i + 1] coil = 'Coil{:d}'.format(i) coil_face = geompy.MakeFaceHW(pf[coil]['dz'], pf[coil]['dr'], 3) coil_face = geompy.MakeTranslation(coil_face, pf[coil]['r'], 0, pf[coil]['z']) coil = geompy.MakeRevolution(coil_face, OZ, 360 * math.pi / 180.0) coil.SetColor(SALOMEDS.Color(c[0], c[1], c[2])) coil_set.append(coil) coil_id = geompy.addToStudy(coil, 'coil_{:d}'.format(i)) gg.createAndDisplayGO(coil_id)
1158, 1173, 1178, 1183, 1188, 1191, 1196, 1336, 1343, 1348, 1353, 1360, 1365, 1372, 1377, 1382, 1387, 1392, 1397, 1402, 1407, 1412, 1417, 1422, 1427, 1432, 1437, 1442, 1517, 1522, 1527, 1532, 1537, 1542, 1547, 1550, 1555, 1560, 1565, 1570, 1575, 1580, 1585, 1588, 1593, 1598, 1603, 1608, 1613, 1618, 1693, 1698, 1703, 1708, 1713, 1718, 1727, 1734, 1741, 1747, 1752, 1757, 1762, 1767, 1772, 1777, 1782, 1787, 1792, 1797, 1802, 1807, 1812, 1817, 1822, 1877, 1882, 1887, 1892, 1897, 1900, 1903, 1910, 1915, 1920, 1927, 1932, 1937, 1942, 1947, 1952, 1957, 1962, 1967, 1974, 1979, 1984, 1989, 1994, 1999, 2004, 2063, 2068, 2071, 2078, 2083, 2088, 2095, 2100, 2105, 2108, 2113, 2118, 2123, 2128, 2133, 2138, 2143, 2150, 2157, 2160, 2163, 2168, 2173, 2178, 2183, 2188, 2193, 2268, 2271, 2276, 2281, 2286, 2291, 2296, 2301, 2306, 2311, 2316, 2321, 2324, 2329, 2334, 2339, 2344, 2349, 2354, 2383, 2388, 2393, 2398, 2403, 2406, 2421, 2426, 2431, 2436, 2439, 2444, 2518, 2584, 2587 ]) resto.SetColor(SALOMEDS.Color(0.333333, 0, 1)) tetto.SetColor(SALOMEDS.Color(0.666667, 0.333333, 0)) lato.SetColor(SALOMEDS.Color(0.333333, 1, 0.498039)) geompy.addToStudy(O, 'O') geompy.addToStudy(OX, 'OX') geompy.addToStudy(OY, 'OY') geompy.addToStudy(OZ, 'OZ') geompy.addToStudy(Test_Car_3, 'Test Car 3') geompy.addToStudyInFather(Test_Car_3, tetto, 'tetto') geompy.addToStudyInFather(Test_Car_3, lato, 'lato') geompy.addToStudyInFather(Test_Car_3, resto, 'resto') geompy.addToStudy(Solid_1, 'Solid_1') geompy.addToStudyInFather(Solid_1, tetto_1, 'tetto') geompy.addToStudyInFather(Solid_1, lato_1, 'lato') geompy.addToStudyInFather(Solid_1, Group_3, 'Group_3')
def Project(): O = geompy.MakeVertex(0, 0, 0) O_id = geompy.addToStudy(O, "O") Vx = geompy.MakeVectorDXDYDZ(1, 0, 0) gst.addShapeToStudy(Vx, "Vx") Vy = geompy.MakeVectorDXDYDZ(0, 1, 0) geompy.addToStudy(Vy, "Vy") Vz = geompy.MakeVectorDXDYDZ(0, 0, 1) geompy.addToStudy(Vz, "Vz") # List of elements which are added to the study Liste = [] ListeV = [] L1 = [] L2 = [] List_id = [] ERREUR = False #gst.deleteShape(Obj) P0 = geompy.MakeVertex(0, 0, 0) geompy.addToStudy(P0, "P0 ") Vd2x_P0 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, -0.8944271909999159) P0_vd2x = geompy.MakeTranslationVectorDistance(P0, Vd2x_P0, 100) Vd2x_P0 = geompy.MakeVector(P0, P0_vd2x) geompy.addToStudy(Vd2x_P0, "Vd2x_P0 ") P1 = geompy.MakeVertex(1000, 0, 0) geompy.addToStudy(P1, "P1 ") Vd2x_P1 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, -0.8944271909999159) P1_vd2x = geompy.MakeTranslationVectorDistance(P1, Vd2x_P1, 100) Vd2x_P1 = geompy.MakeVector(P1, P1_vd2x) geompy.addToStudy(Vd2x_P1, "Vd2x_P1 ") P2 = geompy.MakeVertex(2000, 0, 0) geompy.addToStudy(P2, "P2 ") Vd2x_P2 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, -0.8944271909999159) P2_vd2x = geompy.MakeTranslationVectorDistance(P2, Vd2x_P2, 100) Vd2x_P2 = geompy.MakeVector(P2, P2_vd2x) geompy.addToStudy(Vd2x_P2, "Vd2x_P2 ") P3 = geompy.MakeVertex(3000, 0, 0) geompy.addToStudy(P3, "P3 ") Vd2x_P3 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, -0.8944271909999159) P3_vd2x = geompy.MakeTranslationVectorDistance(P3, Vd2x_P3, 100) Vd2x_P3 = geompy.MakeVector(P3, P3_vd2x) geompy.addToStudy(Vd2x_P3, "Vd2x_P3 ") P4 = geompy.MakeVertex(4000, 0, 0) geompy.addToStudy(P4, "P4 ") Vd2x_P4 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, 0.8944271909999159) P4_vd2x = geompy.MakeTranslationVectorDistance(P4, Vd2x_P4, 100) Vd2x_P4 = geompy.MakeVector(P4, P4_vd2x) geompy.addToStudy(Vd2x_P4, "Vd2x_P4 ") P5 = geompy.MakeVertex(3500, 0, 1000) geompy.addToStudy(P5, "P5 ") Vd2x_P5 = geompy.MakeVectorDXDYDZ(0.4472135954999579, 0.0, -0.8944271909999159) P5_vd2x = geompy.MakeTranslationVectorDistance(P5, Vd2x_P5, 100) Vd2x_P5 = geompy.MakeVector(P5, P5_vd2x) geompy.addToStudy(Vd2x_P5, "Vd2x_P5 ") P6 = geompy.MakeVertex(2500, 0, 1000) geompy.addToStudy(P6, "P6 ") Vd2x_P6 = geompy.MakeVectorDXDYDZ(0.4472135954999579, 0.0, -0.8944271909999159) P6_vd2x = geompy.MakeTranslationVectorDistance(P6, Vd2x_P6, 100) Vd2x_P6 = geompy.MakeVector(P6, P6_vd2x) geompy.addToStudy(Vd2x_P6, "Vd2x_P6 ") P7 = geompy.MakeVertex(1500, 0, 1000) geompy.addToStudy(P7, "P7 ") Vd2x_P7 = geompy.MakeVectorDXDYDZ(0.4472135954999579, 0.0, -0.8944271909999159) P7_vd2x = geompy.MakeTranslationVectorDistance(P7, Vd2x_P7, 100) Vd2x_P7 = geompy.MakeVector(P7, P7_vd2x) geompy.addToStudy(Vd2x_P7, "Vd2x_P7 ") P8 = geompy.MakeVertex(500, 0, 1000) geompy.addToStudy(P8, "P8 ") Vd2x_P8 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, 0.8944271909999159) P8_vd2x = geompy.MakeTranslationVectorDistance(P8, Vd2x_P8, 100) Vd2x_P8 = geompy.MakeVector(P8, P8_vd2x) geompy.addToStudy(Vd2x_P8, "Vd2x_P8 ") P9 = geompy.MakeVertex(1000, 0, 2000) geompy.addToStudy(P9, "P9 ") Vd2x_P9 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, -0.8944271909999159) P9_vd2x = geompy.MakeTranslationVectorDistance(P9, Vd2x_P9, 100) Vd2x_P9 = geompy.MakeVector(P9, P9_vd2x) geompy.addToStudy(Vd2x_P9, "Vd2x_P9 ") P10 = geompy.MakeVertex(2000, 0, 2000) geompy.addToStudy(P10, "P10 ") Vd2x_P10 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, -0.8944271909999159) P10_vd2x = geompy.MakeTranslationVectorDistance(P10, Vd2x_P10, 100) Vd2x_P10 = geompy.MakeVector(P10, P10_vd2x) geompy.addToStudy(Vd2x_P10, "Vd2x_P10 ") P11 = geompy.MakeVertex(3000, 0, 2000) geompy.addToStudy(P11, "P11 ") Vd2x_P11 = geompy.MakeVectorDXDYDZ(0.4472135954999579, 0.0, 0.8944271909999159) P11_vd2x = geompy.MakeTranslationVectorDistance(P11, Vd2x_P11, 100) Vd2x_P11 = geompy.MakeVector(P11, P11_vd2x) geompy.addToStudy(Vd2x_P11, "Vd2x_P11 ") P12 = geompy.MakeVertex(2500, 0, 3000) geompy.addToStudy(P12, "P12 ") Vd2x_P12 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, -0.8944271909999159) P12_vd2x = geompy.MakeTranslationVectorDistance(P12, Vd2x_P12, 100) Vd2x_P12 = geompy.MakeVector(P12, P12_vd2x) geompy.addToStudy(Vd2x_P12, "Vd2x_P12 ") P13 = geompy.MakeVertex(1500, 0, 3000) geompy.addToStudy(P13, "P13 ") Vd2x_P13 = geompy.MakeVectorDXDYDZ(-0.4472135954999579, 0.0, 0.8944271909999159) P13_vd2x = geompy.MakeTranslationVectorDistance(P13, Vd2x_P13, 100) Vd2x_P13 = geompy.MakeVector(P13, P13_vd2x) geompy.addToStudy(Vd2x_P13, "Vd2x_P13 ") try: print("Add V0") V0 = geompy.MakeVector(P0, P1) #Liste.append([P0,"P0"]) geompy.addToStudy(V0, "V0") Liste.append([V0, "V0"]) ListeV.append(V0) _C1 = geompy.MakeCircle(P0, V0, 60) _C2 = geompy.MakeCircle(P0, V0, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V0M = smesh.Mesh(V0) Decoupage = V0M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V0M, 'V0') V0M.Compute() V0M.Group(P0) V0M.Group(P1) V0M.GroupOnGeom(V0) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V1") V1 = geompy.MakeVector(P1, P2) #Liste.append([P1,"P1"]) geompy.addToStudy(V1, "V1") Liste.append([V1, "V1"]) ListeV.append(V1) _C1 = geompy.MakeCircle(P1, V1, 60) _C2 = geompy.MakeCircle(P1, V1, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V1M = smesh.Mesh(V1) Decoupage = V1M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V1M, 'V1') V1M.Compute() V1M.Group(P1) V1M.Group(P2) V1M.GroupOnGeom(V1) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V2") V2 = geompy.MakeVector(P2, P3) #Liste.append([P2,"P2"]) geompy.addToStudy(V2, "V2") Liste.append([V2, "V2"]) ListeV.append(V2) _C1 = geompy.MakeCircle(P2, V2, 60) _C2 = geompy.MakeCircle(P2, V2, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V2M = smesh.Mesh(V2) Decoupage = V2M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V2M, 'V2') V2M.Compute() V2M.Group(P2) V2M.Group(P3) V2M.GroupOnGeom(V2) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V3") V3 = geompy.MakeVector(P3, P4) #Liste.append([P3,"P3"]) geompy.addToStudy(V3, "V3") Liste.append([V3, "V3"]) ListeV.append(V3) _C1 = geompy.MakeCircle(P3, V3, 60) _C2 = geompy.MakeCircle(P3, V3, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V3M = smesh.Mesh(V3) Decoupage = V3M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V3M, 'V3') V3M.Compute() V3M.Group(P3) V3M.Group(P4) V3M.GroupOnGeom(V3) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V4") V4 = geompy.MakeVector(P4, P5) #Liste.append([P4,"P4"]) geompy.addToStudy(V4, "V4") Liste.append([V4, "V4"]) ListeV.append(V4) _C1 = geompy.MakeCircle(P4, V4, 60) _C2 = geompy.MakeCircle(P4, V4, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V4M = smesh.Mesh(V4) Decoupage = V4M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V4M, 'V4') V4M.Compute() V4M.Group(P4) V4M.Group(P5) V4M.GroupOnGeom(V4) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V5") V5 = geompy.MakeVector(P5, P6) #Liste.append([P5,"P5"]) geompy.addToStudy(V5, "V5") Liste.append([V5, "V5"]) ListeV.append(V5) _C1 = geompy.MakeCircle(P5, V5, 60) _C2 = geompy.MakeCircle(P5, V5, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V5M = smesh.Mesh(V5) Decoupage = V5M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V5M, 'V5') V5M.Compute() V5M.Group(P5) V5M.Group(P6) V5M.GroupOnGeom(V5) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V6") V6 = geompy.MakeVector(P6, P7) #Liste.append([P6,"P6"]) geompy.addToStudy(V6, "V6") Liste.append([V6, "V6"]) ListeV.append(V6) _C1 = geompy.MakeCircle(P6, V6, 60) _C2 = geompy.MakeCircle(P6, V6, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V6M = smesh.Mesh(V6) Decoupage = V6M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V6M, 'V6') V6M.Compute() V6M.Group(P6) V6M.Group(P7) V6M.GroupOnGeom(V6) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V7") V7 = geompy.MakeVector(P7, P8) #Liste.append([P7,"P7"]) geompy.addToStudy(V7, "V7") Liste.append([V7, "V7"]) ListeV.append(V7) _C1 = geompy.MakeCircle(P7, V7, 60) _C2 = geompy.MakeCircle(P7, V7, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V7M = smesh.Mesh(V7) Decoupage = V7M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V7M, 'V7') V7M.Compute() V7M.Group(P7) V7M.Group(P8) V7M.GroupOnGeom(V7) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V8") V8 = geompy.MakeVector(P8, P9) #Liste.append([P8,"P8"]) geompy.addToStudy(V8, "V8") Liste.append([V8, "V8"]) ListeV.append(V8) _C1 = geompy.MakeCircle(P8, V8, 60) _C2 = geompy.MakeCircle(P8, V8, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V8M = smesh.Mesh(V8) Decoupage = V8M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V8M, 'V8') V8M.Compute() V8M.Group(P8) V8M.Group(P9) V8M.GroupOnGeom(V8) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V9") V9 = geompy.MakeVector(P9, P10) #Liste.append([P9,"P9"]) geompy.addToStudy(V9, "V9") Liste.append([V9, "V9"]) ListeV.append(V9) _C1 = geompy.MakeCircle(P9, V9, 60) _C2 = geompy.MakeCircle(P9, V9, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V9M = smesh.Mesh(V9) Decoupage = V9M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V9M, 'V9') V9M.Compute() V9M.Group(P9) V9M.Group(P10) V9M.GroupOnGeom(V9) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V10") V10 = geompy.MakeVector(P10, P11) #Liste.append([P10,"P10"]) geompy.addToStudy(V10, "V10") Liste.append([V10, "V10"]) ListeV.append(V10) _C1 = geompy.MakeCircle(P10, V10, 60) _C2 = geompy.MakeCircle(P10, V10, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V10M = smesh.Mesh(V10) Decoupage = V10M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V10M, 'V10') V10M.Compute() V10M.Group(P10) V10M.Group(P11) V10M.GroupOnGeom(V10) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V11") V11 = geompy.MakeVector(P11, P12) #Liste.append([P11,"P11"]) geompy.addToStudy(V11, "V11") Liste.append([V11, "V11"]) ListeV.append(V11) _C1 = geompy.MakeCircle(P11, V11, 60) _C2 = geompy.MakeCircle(P11, V11, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V11M = smesh.Mesh(V11) Decoupage = V11M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V11M, 'V11') V11M.Compute() V11M.Group(P11) V11M.Group(P12) V11M.GroupOnGeom(V11) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V12") V12 = geompy.MakeVector(P12, P13) #Liste.append([P12,"P12"]) geompy.addToStudy(V12, "V12") Liste.append([V12, "V12"]) ListeV.append(V12) _C1 = geompy.MakeCircle(P12, V12, 60) _C2 = geompy.MakeCircle(P12, V12, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V12M = smesh.Mesh(V12) Decoupage = V12M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V12M, 'V12') V12M.Compute() V12M.Group(P12) V12M.Group(P13) V12M.GroupOnGeom(V12) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V13") V13 = geompy.MakeVector(P8, P0) #Liste.append([P8,"P8"]) geompy.addToStudy(V13, "V13") Liste.append([V13, "V13"]) ListeV.append(V13) _C1 = geompy.MakeCircle(P8, V13, 60) _C2 = geompy.MakeCircle(P8, V13, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V13M = smesh.Mesh(V13) Decoupage = V13M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V13M, 'V13') V13M.Compute() V13M.Group(P8) V13M.Group(P0) V13M.GroupOnGeom(V13) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V14") V14 = geompy.MakeVector(P1, P8) #Liste.append([P1,"P1"]) geompy.addToStudy(V14, "V14") Liste.append([V14, "V14"]) ListeV.append(V14) _C1 = geompy.MakeCircle(P1, V14, 60) _C2 = geompy.MakeCircle(P1, V14, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V14M = smesh.Mesh(V14) Decoupage = V14M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V14M, 'V14') V14M.Compute() V14M.Group(P1) V14M.Group(P8) V14M.GroupOnGeom(V14) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V15") V15 = geompy.MakeVector(P7, P1) #Liste.append([P7,"P7"]) geompy.addToStudy(V15, "V15") Liste.append([V15, "V15"]) ListeV.append(V15) _C1 = geompy.MakeCircle(P7, V15, 60) _C2 = geompy.MakeCircle(P7, V15, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V15M = smesh.Mesh(V15) Decoupage = V15M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V15M, 'V15') V15M.Compute() V15M.Group(P7) V15M.Group(P1) V15M.GroupOnGeom(V15) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V16") V16 = geompy.MakeVector(P2, P7) #Liste.append([P2,"P2"]) geompy.addToStudy(V16, "V16") Liste.append([V16, "V16"]) ListeV.append(V16) _C1 = geompy.MakeCircle(P2, V16, 60) _C2 = geompy.MakeCircle(P2, V16, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V16M = smesh.Mesh(V16) Decoupage = V16M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V16M, 'V16') V16M.Compute() V16M.Group(P2) V16M.Group(P7) V16M.GroupOnGeom(V16) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V17") V17 = geompy.MakeVector(P6, P2) #Liste.append([P6,"P6"]) geompy.addToStudy(V17, "V17") Liste.append([V17, "V17"]) ListeV.append(V17) _C1 = geompy.MakeCircle(P6, V17, 60) _C2 = geompy.MakeCircle(P6, V17, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V17M = smesh.Mesh(V17) Decoupage = V17M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V17M, 'V17') V17M.Compute() V17M.Group(P6) V17M.Group(P2) V17M.GroupOnGeom(V17) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V18") V18 = geompy.MakeVector(P3, P6) #Liste.append([P3,"P3"]) geompy.addToStudy(V18, "V18") Liste.append([V18, "V18"]) ListeV.append(V18) _C1 = geompy.MakeCircle(P3, V18, 60) _C2 = geompy.MakeCircle(P3, V18, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V18M = smesh.Mesh(V18) Decoupage = V18M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V18M, 'V18') V18M.Compute() V18M.Group(P3) V18M.Group(P6) V18M.GroupOnGeom(V18) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V19") V19 = geompy.MakeVector(P5, P3) #Liste.append([P5,"P5"]) geompy.addToStudy(V19, "V19") Liste.append([V19, "V19"]) ListeV.append(V19) _C1 = geompy.MakeCircle(P5, V19, 60) _C2 = geompy.MakeCircle(P5, V19, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V19M = smesh.Mesh(V19) Decoupage = V19M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V19M, 'V19') V19M.Compute() V19M.Group(P5) V19M.Group(P3) V19M.GroupOnGeom(V19) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V20") V20 = geompy.MakeVector(P11, P5) #Liste.append([P11,"P11"]) geompy.addToStudy(V20, "V20") Liste.append([V20, "V20"]) ListeV.append(V20) _C1 = geompy.MakeCircle(P11, V20, 60) _C2 = geompy.MakeCircle(P11, V20, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V20M = smesh.Mesh(V20) Decoupage = V20M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V20M, 'V20') V20M.Compute() V20M.Group(P11) V20M.Group(P5) V20M.GroupOnGeom(V20) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V21") V21 = geompy.MakeVector(P6, P11) #Liste.append([P6,"P6"]) geompy.addToStudy(V21, "V21") Liste.append([V21, "V21"]) ListeV.append(V21) _C1 = geompy.MakeCircle(P6, V21, 60) _C2 = geompy.MakeCircle(P6, V21, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V21M = smesh.Mesh(V21) Decoupage = V21M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V21M, 'V21') V21M.Compute() V21M.Group(P6) V21M.Group(P11) V21M.GroupOnGeom(V21) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V22") V22 = geompy.MakeVector(P10, P6) #Liste.append([P10,"P10"]) geompy.addToStudy(V22, "V22") Liste.append([V22, "V22"]) ListeV.append(V22) _C1 = geompy.MakeCircle(P10, V22, 60) _C2 = geompy.MakeCircle(P10, V22, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V22M = smesh.Mesh(V22) Decoupage = V22M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V22M, 'V22') V22M.Compute() V22M.Group(P10) V22M.Group(P6) V22M.GroupOnGeom(V22) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V23") V23 = geompy.MakeVector(P7, P10) #Liste.append([P7,"P7"]) geompy.addToStudy(V23, "V23") Liste.append([V23, "V23"]) ListeV.append(V23) _C1 = geompy.MakeCircle(P7, V23, 60) _C2 = geompy.MakeCircle(P7, V23, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V23M = smesh.Mesh(V23) Decoupage = V23M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V23M, 'V23') V23M.Compute() V23M.Group(P7) V23M.Group(P10) V23M.GroupOnGeom(V23) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V24") V24 = geompy.MakeVector(P9, P7) #Liste.append([P9,"P9"]) geompy.addToStudy(V24, "V24") Liste.append([V24, "V24"]) ListeV.append(V24) _C1 = geompy.MakeCircle(P9, V24, 60) _C2 = geompy.MakeCircle(P9, V24, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V24M = smesh.Mesh(V24) Decoupage = V24M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V24M, 'V24') V24M.Compute() V24M.Group(P9) V24M.Group(P7) V24M.GroupOnGeom(V24) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V25") V25 = geompy.MakeVector(P13, P9) #Liste.append([P13,"P13"]) geompy.addToStudy(V25, "V25") Liste.append([V25, "V25"]) ListeV.append(V25) _C1 = geompy.MakeCircle(P13, V25, 60) _C2 = geompy.MakeCircle(P13, V25, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V25M = smesh.Mesh(V25) Decoupage = V25M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V25M, 'V25') V25M.Compute() V25M.Group(P13) V25M.Group(P9) V25M.GroupOnGeom(V25) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V26") V26 = geompy.MakeVector(P10, P13) #Liste.append([P10,"P10"]) geompy.addToStudy(V26, "V26") Liste.append([V26, "V26"]) ListeV.append(V26) _C1 = geompy.MakeCircle(P10, V26, 60) _C2 = geompy.MakeCircle(P10, V26, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V26M = smesh.Mesh(V26) Decoupage = V26M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V26M, 'V26') V26M.Compute() V26M.Group(P10) V26M.Group(P13) V26M.GroupOnGeom(V26) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] try: print("Add V27") V27 = geompy.MakeVector(P12, P10) #Liste.append([P12,"P12"]) geompy.addToStudy(V27, "V27") Liste.append([V27, "V27"]) ListeV.append(V27) _C1 = geompy.MakeCircle(P12, V27, 60) _C2 = geompy.MakeCircle(P12, V27, 57) FaceTube = geompy.MakeFaceWires([_C1, _C2], 1) Liste.append([_C1, "CercleExt"]) Liste.append([_C2, "CercleInt"]) except: ERREUR = True print(" =>ERROR BUILDING THE GEOMETRY!") for x in Liste: geompy.addToStudy(x[0], x[1]) return try: V27M = smesh.Mesh(V27) Decoupage = V27M.Segment() Decoupage.NumberOfSegments(8) smesh.SetName(V27M, 'V27') V27M.Compute() V27M.Group(P12) V27M.Group(P10) V27M.GroupOnGeom(V27) except: ERREUR = True print(" =>ERROR WHILE GENERATING THE MESH!_") return if ListeV != []: _W = geompy.MakeWire(ListeV, 1e-7) Pipe = geompy.MakePipe(FaceTube, _W) Pipe.SetColor(SALOMEDS.Color(0.8, 0.8, 0.8)) Pipe_id = geompy.addToStudy(Pipe, "Pipe") gg.createAndDisplayGO(Pipe_id) gg.setDisplayMode(Pipe_id, 1) for x in Liste: geompy.addToStudyInFather(Pipe, x[0], x[1]) Liste = [] ListeV = [] #Creates the mesh compound if not (ERREUR): Completed_Mesh = smesh.Concatenate([ V0M.GetMesh(), V1M.GetMesh(), V2M.GetMesh(), V3M.GetMesh(), V4M.GetMesh(), V5M.GetMesh(), V6M.GetMesh(), V7M.GetMesh(), V8M.GetMesh(), V9M.GetMesh(), V10M.GetMesh(), V11M.GetMesh(), V12M.GetMesh(), V13M.GetMesh(), V14M.GetMesh(), V15M.GetMesh(), V16M.GetMesh(), V17M.GetMesh(), V18M.GetMesh(), V19M.GetMesh(), V20M.GetMesh(), V21M.GetMesh(), V22M.GetMesh(), V23M.GetMesh(), V24M.GetMesh(), V25M.GetMesh(), V26M.GetMesh(), V27M.GetMesh(), ], 1, 0, 1e-05) coincident_nodes = Completed_Mesh.FindCoincidentNodes(1e-05) Completed_Mesh.MergeNodes(coincident_nodes) equal_elements = Completed_Mesh.FindEqualElements(Completed_Mesh) Completed_Mesh.MergeElements(equal_elements) smesh.SetName(Completed_Mesh.GetMesh(), 'Completed_Mesh') if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0) time2 = time.time() dtime = time2 - time1 print("------------------------") print("Duration of construction:" + str(round(dtime, 2)) + "s")
Regular_1D_4 = Mesh_5.Segment() Quadrangle_2D_4 = Mesh_5.Quadrangle() isDone = Mesh_5.Compute() Mesh_6 = smesh.Mesh(Quadrangle_Face_6) status = Mesh_6.AddHypothesis(Local_Length_1) Regular_1D_5 = Mesh_6.Segment() Quadrangle_2D_5 = Mesh_6.Quadrangle() isDone = Mesh_6.Compute() Mesh_7 = smesh.Mesh(Quadrangle_Face_7) status = Mesh_7.AddHypothesis(Local_Length_1) Regular_1D_6 = Mesh_7.Segment() Quadrangle_2D_6 = Mesh_7.Quadrangle() isDone = Mesh_7.Compute() a1 = Mesh_1.CreateEmptyGroup(SMESH.FACE, '1') nbAdd = a1.AddFrom(Mesh_1.GetMesh()) a1.SetColor(SALOMEDS.Color(0, 0.666667, 1)) a2 = Mesh_2.CreateEmptyGroup(SMESH.FACE, '2') nbAdd = a2.AddFrom(Mesh_2.GetMesh()) a2.SetColor(SALOMEDS.Color(0, 0.666667, 1)) a3 = Mesh_3.CreateEmptyGroup(SMESH.FACE, '3') nbAdd = a3.AddFrom(Mesh_3.GetMesh()) a3.SetColor(SALOMEDS.Color(0, 0.666667, 1)) a4 = Mesh_4.CreateEmptyGroup(SMESH.FACE, '4') nbAdd = a4.AddFrom(Mesh_4.GetMesh()) a4.SetColor(SALOMEDS.Color(0, 0.666667, 1)) a5 = Mesh_5.CreateEmptyGroup(SMESH.FACE, '5') nbAdd = a5.AddFrom(Mesh_5.GetMesh()) a5.SetColor(SALOMEDS.Color(0, 0.666667, 1)) a6 = Mesh_6.CreateEmptyGroup(SMESH.FACE, '6') nbAdd = a6.AddFrom(Mesh_6.GetMesh()) a6.SetColor(SALOMEDS.Color(0, 0.666667, 1))