def __salome_genere_section_catalogue(self, SANS_RECALAGE=None): #print obj formecentre = {} for k, sec in self.section_catalogue.iteritems(): #sec=v[4] gen = self.generation[sec[0]] extl, intl, dcar = gen.gen_lists(sec[1]) ll = self.__generation_salomesubsurface(extl) for a in intl: ll.extend(self.__generation_salomesubsurface(a)) #for v in ll: # geompy.addToStudy(v,k) surface = geompy.MakeFaceWires(ll, 1) #gestion de la translation surfacet = surface if (SANS_RECALAGE != "OUI" and (sec[2][15] < -1e-5 or sec[2][15] > 1e-5 or sec[2][16] < -1e-5 or sec[2][16] > 1e-5)): surfacet = geompy.MakeTranslation(surface, -sec[2][15], -sec[2][16], 0) surfacetr = surfacet #gestion de la rotation p0 = geompy.MakeVertex(0, 0, 0) p1 = geompy.MakeVertex(0, 0, 1) vecteurr = geompy.MakeVector(p0, p1) if (SANS_RECALAGE != "OUI" and (sec[2][14] < -1e-5 or sec[2][14] > 1e-5)): #print "rotation",-math.pi*sec[2][14]/180. surfacetr = geompy.MakeRotation(surfacet, vecteurr, -sec[2][14]) formecentre[k] = surfacetr return formecentre
# linex.append(listey) # for b in range(0,nsub+1): # newlinex=geompy.MakeLineTwoPnt(node[a][b], node[a+1][b]) # geompy.addToStudy( newlinex, 'lxX%dY%d'%(a,b) ) # listex.append(newlinex) # newliney=geompy.MakeLineTwoPnt(node[b][a], node[b][a+1]) # geompy.addToStudy( newliney, 'lyX%dY%d'%(a,b) ) # listey.append(newliney) #generation des faces de contact facenodeup = [] for a in range(0, nsub + 1): liste = [] facenodeup.append(liste) for b in range(0, nsub + 1): newvertex = geompy.MakeTranslation(node[a][b], 0, 0, 1) newline = geompy.MakeLineTwoPnt(node[a][b], newvertex) newface = geompy.MakeFaceObjHW(newline, phitop, phitop) #geompy.addToStudy( newface, 'faceX%dY%d'%(a,b) ) liste.append(newface) #generation du grand rectange V0 = geompy.MakeVertex(0 - phitop / 2., 0 - phitop / 2., 0) V1 = geompy.MakeVertex(lx + phitop / 2., ly + phitop / 2., h) Box_1 = geompy.MakeBoxTwoPnt(V0, V1) #geompy.addToStudy( Box_1, 'Box_1' ) #generation de la face inferieur grand rectange V0 = geompy.MakeVertex(lx / 2., ly / 2., 0) V1 = geompy.MakeVertex(lx / 2., ly / 2., h) newline = geompy.MakeLineTwoPnt(V0, V1)
def RebuildData(theStudy): geompy.init_geom(theStudy) global Edge_1, Edge_2, Vertex_3, Revolution_1, Vertex_5, Vertex_4, Vertex_6, Face_1, Cone_1, Edge_5, Edge_3, Cylinder_1, Edge_4, Translation_1, Y, Vertex_2, Common_1, Cut_1, Compound_1, Vector_1, Fillet_1, X, Box_1, Rotation_1, Partition_1, Cone_1_edge_7, Torus_1, Vertex_1, Circle_1 Vertex_1 = geompy.MakeVertex(200, 200, 0) Vertex_2 = geompy.MakeVertexWithRef(Vertex_1, 0, 0, 200) Vector_1 = geompy.MakeVector(Vertex_1, Vertex_2) Cone_1 = geompy.MakeConeR1R2H(100, 0, 300) Cylinder_1 = geompy.MakeCylinder(Vertex_2, Vector_1, 100, 100) geomObj_1 = geompy.GetSubShape(Cone_1, [7]) Circle_1 = geompy.MakeCircle(Vertex_1, Vector_1, 100) Cone_1_edge_7 = geompy.GetSubShape(Cone_1, [7]) Revolution_1 = geompy.MakeRevolution2Ways(Circle_1, Cone_1_edge_7, 45*math.pi/180.0) Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) Torus_1 = geompy.MakeTorusRR(200, 75) Common_1 = geompy.MakeCommon(Torus_1, Box_1) Cut_1 = geompy.MakeCut(Torus_1, Box_1) Translation_1 = geompy.MakeTranslation(Torus_1, 190, 190, 0) Y = geompy.MakeVectorDXDYDZ(0, 100, 0) X = geompy.MakeVectorDXDYDZ(100, 0, 0) Rotation_1 = geompy.MakeRotation(Translation_1, Y, -90*math.pi/180.0) Compound_1 = geompy.MakeCompound([Translation_1, Torus_1, Rotation_1]) Fillet_1 = geompy.MakeFilletAll(Box_1, 35) Vertex_3 = geompy.MakeVertex(0, 0, 0) Vertex_4 = geompy.MakeVertex(0, 0, 200) Vertex_5 = geompy.MakeVertex(200, 0, 200) Vertex_6 = geompy.MakeVertex(200, 0, 0) Edge_1 = geompy.MakeEdge(Vertex_3, Vertex_4) Edge_2 = geompy.MakeEdge(Vertex_4, Vertex_5) Edge_3 = geompy.MakeEdge(Vertex_5, Vertex_6) Edge_4 = geompy.MakeEdge(Vertex_6, Vertex_3) Face_1 = geompy.MakeFaceWires([Edge_1, Edge_2, Edge_3, Edge_4], 1) Edge_5 = geompy.MakeEdge(Vertex_3, Vertex_5) Partition_1 = geompy.MakePartition([Face_1], [Edge_5], [], [], geompy.ShapeType["FACE"], 0, [], 0) geompy.addToStudy( Vertex_1, "Vertex_1" ) geompy.addToStudy( Vertex_2, "Vertex_2" ) geompy.addToStudy( Vector_1, "Vector_1" ) geompy.addToStudy( Cone_1, "Cone_1" ) geompy.addToStudy( Cylinder_1, "Cylinder_1" ) geompy.addToStudy( Circle_1, "Circle_1" ) geompy.addToStudyInFather( Cone_1, Cone_1_edge_7, "Cone_1:edge_7" ) geompy.addToStudy( Revolution_1, "Revolution_1" ) geompy.addToStudy( Box_1, "Box_1" ) geompy.addToStudy( Torus_1, "Torus_1" ) geompy.addToStudy( Common_1, "Common_1" ) geompy.addToStudy( Cut_1, "Cut_1" ) geompy.addToStudy( Translation_1, "Translation_1" ) geompy.addToStudy( Y, "Y" ) geompy.addToStudy( X, "X" ) geompy.addToStudy( Rotation_1, "Rotation_1" ) geompy.addToStudy( Compound_1, "Compound_1" ) geompy.addToStudy( Fillet_1, "Fillet_1" ) geompy.addToStudy( Vertex_3, "Vertex_3" ) geompy.addToStudy( Vertex_4, "Vertex_4" ) geompy.addToStudy( Vertex_5, "Vertex_5" ) geompy.addToStudy( Vertex_6, "Vertex_6" ) geompy.addToStudy( Edge_1, "Edge_1" ) geompy.addToStudy( Edge_2, "Edge_2" ) geompy.addToStudy( Edge_3, "Edge_3" ) geompy.addToStudy( Edge_4, "Edge_4" ) geompy.addToStudy( Face_1, "Face_1" ) geompy.addToStudy( Edge_5, "Edge_5" ) geompy.addToStudy( Partition_1, "Partition_1" ) ### Store presentation parameters of displayed objects import iparameters ipar = iparameters.IParameters(theStudy.GetModuleParameters("Interface Applicative", "GEOM", 1)) #Set up entries: # set up entry GEOM_11 (Cut_1) parameters ipar.setParameter("GEOM_11", "OCCViewer_0_Visibility", "On") ipar.setParameter("GEOM_11", "OCCViewer_0_DisplayMode", "1") ipar.setParameter("GEOM_11", "OCCViewer_0_Transparency", "0") ipar.setParameter("GEOM_11", "OCCViewer_0_Isos", "1:1") pass
def CreateGEOM(injLens, injRads, injAngs, wallS): L1 = injLens[0] L2 = injLens[1] L3 = injLens[2] L4 = injLens[3] L5 = injLens[4] L6 = injLens[5] # R0 = injRads[0] R1 = injRads[1] R2 = injRads[2] R3 = injRads[3] R4 = injRads[4] # A1 = injAngs[0] # S = wallS # # Printing input # LSUMM = L1 + L2 + L3 + L4 + L5 + L6 DX1= math.tan(A1*math.pi/180.)*L3 + R3 - R0 # print "Input Data" print "L1, L2, L3, L4, L5, L6" print L1, L2, L3, L4, L5, L6 print "R0, R1, R2, R3, R4" print R0, R1, R2, R3, R4 print "A1 = ", A1 print "S = ", S # print "Intermediate variables: " print "LSUMM = ", LSUMM print "DX1 = ", DX1 # # # # oXYZ = geompy.MakeVertex(0, 0, 0) xPnt = geompy.MakeVertex(1, 0, 0) yPnt = geompy.MakeVertex(0, 1, 0) zPnt = geompy.MakeVertex(0, 0, 1) oX = geompy.MakeVector(oXYZ, xPnt) oY = geompy.MakeVector(oXYZ, yPnt) oZ = geompy.MakeVector(oXYZ, zPnt) # # Inlet and nozzle points and faces # P000 = geompy.MakeVertexWithRef(oXYZ, -(L1+L2), R1, 0) P001 = geompy.MakeVertexWithRef(oXYZ, -L2, R1, 0) P002 = geompy.MakeVertexWithRef(oXYZ, -L2, 0, 0) P003 = geompy.MakeVertexWithRef(oXYZ, -(L1+L2), 0, 0) # P004 = geompy.MakeVertexWithRef(oXYZ, 0, R2, 0) P005 = geompy.MakeVertexWithRef(oXYZ, 0, 0, 0) # P006 = geompy.MakeVertexWithRef(P000, 0, S, 0) P007 = geompy.MakeVertexWithRef(P006, L1,0, 0) P008 = geompy.MakeVertexWithRef(oXYZ, DX1,R0,0) P009 = geompy.MakeVertexWithRef(oXYZ, -(L1+L2), R0, 0) # F000 = geompy.MakeQuad4Vertices(P000, P001, P002, P003) F001 = geompy.MakeQuad4Vertices(P001, P002, P005, P004) F002 = geompy.MakeQuad4Vertices(P006, P007, P008, P009) # # Mixing chamber # P009 = geompy.MakeVertexWithRef(P004, 0, S, 0) P010 = geompy.MakeVertexWithRef(P005, L3,0, 0) P011 = geompy.MakeVertexWithRef(P010, 0,R3, 0) E000 = geompy.MakeLineTwoPnt(P008, P011) P012 = geompy.MakeVertexOnCurve(E000,0.9) P013 = geompy.MakeVertexWithRef(P010, L4, 0, 0) P014 = geompy.MakeVertexWithRef(P013, 0, R3, 0) # F003 = geompy.MakeQuad4Vertices(P009, P007, P008, P012) F004 = geompy.MakeQuad4Vertices(P004, P009, P012, P011) F005 = geompy.MakeQuad4Vertices(P004, P005, P010, P011) F006 = geompy.MakeQuad4Vertices(P010, P011, P014, P013) # # Diffusor and out tube # P015 = geompy.MakeVertexWithRef(P013, L5, 0, 0) P016 = geompy.MakeVertexWithRef(P015, 0, R4, 0) P017 = geompy.MakeVertexWithRef(P016, L6, 0, 0) P018 = geompy.MakeVertexWithRef(P017, 0, -R4,0) # F007 = geompy.MakeQuad4Vertices(P013, P014, P016, P015) F008 = geompy.MakeQuad4Vertices(P015, P016, P017, P018) # faceComp = geompy.MakeShell([F000, F001, F002, F003, F004, F005, F006, F007, F008]) # # Solid geomtry # sBase1 = geompy.MakeRotation(faceComp, oX, 0) sBase2 = geompy.MakeRotation(sBase1, oX, 45.*math.pi/180.) sBase3 = geompy.MakeRotation(sBase2, oX, 90.*math.pi/180.) # solid1 = geompy.MakeRevolution(sBase1, oX, 45.*math.pi/180.) solid2 = geompy.MakeRevolution(sBase2, oX, 90.*math.pi/180.) solid3 = geompy.MakeRevolution(sBase3, oX, 45.*math.pi/180.) # # Cutters # E002 = geompy.MakeLineTwoPnt(P005, P004) E003 = geompy.MakeRotation(E002, oX, 45.*math.pi/180.) E004 = geompy.MakeRotation(E003, oX, 90.*math.pi/180.) E005 = geompy.MakeRotation(E004, oX, 45.*math.pi/180.) P019 = geompy.MakeVertexOnCurve(E002,0.5) P020 = geompy.MakeVertexOnCurve(E003,0.5) P021 = geompy.MakeVertexOnCurve(E004,0.5) P022 = geompy.MakeVertexOnCurve(E005,0.5) zmin = geompy.PointCoordinates(oXYZ)[2] zmax = geompy.PointCoordinates(P020)[2] ymin = geompy.PointCoordinates(P022)[1] ymax = geompy.PointCoordinates(P019)[1] print "ymin, ymax, zmin, zmax" print ymin, ymax, zmin, zmax # E006 = geompy.MakeLineTwoPnt(P019, P020) E007 = geompy.MakeLineTwoPnt(P020, P021) E008 = geompy.MakeLineTwoPnt(P021, P022) E009 = geompy.MakeLineTwoPnt(P021, P022) edgeComp1 = geompy.MakeCompound([E006, E007, E008, E009]) edgeComp2 = geompy.MakeTranslation(edgeComp1, -(2*L1 + 2*L2), 0, 0) cutter1 = geompy.MakePrismVecH(edgeComp2, oX, LSUMM*2) # # Hexa solid # solid1_hex_v1 = geompy.MakePartition([solid1], [cutter1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) solid2_hex_v1 = geompy.MakePartition([solid2], [cutter1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) solid3_hex_v1 = geompy.MakePartition([solid3], [cutter1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) dom_v1 = geompy.MakeCompound([solid1_hex_v1, solid2_hex_v1, solid3_hex_v1]) hsolids1 = geompy.SubShapeAll(dom_v1, geompy.ShapeType["SOLID"]) nSolids = len(hsolids1) hsolids2 = [] for jSolid in xrange(0,nSolids): solidCDG = geompy.MakeCDG(hsolids1[jSolid]) coordCDG = geompy.PointCoordinates(solidCDG) ys = coordCDG[1] zs = coordCDG[2] zOk = (zs >= zmin) * (zs <= zmax) yOk = (ys >= ymin) * (ys <= ymax) if not(zOk and yOk): hsolids2.append(hsolids1[jSolid]) # Creasting hexahedrons near the center sBase4 = geompy.MakeQuad4Vertices(P019, P020, P021, P022) sBase5 = geompy.MakeTranslation(sBase4, -(L1 + L2), 0, 0) hsolids2.append(geompy.MakePrismVecH(sBase5, oX, L1)) sBase6 = geompy.MakeTranslation(sBase5, L1, 0, 0) hsolids2.append(geompy.MakePrismVecH(sBase6, oX, L2)) sBase7 = geompy.MakeTranslation(sBase6, L2, 0, 0) hsolids2.append(geompy.MakePrismVecH(sBase7, oX, L3)) sBase8 = geompy.MakeTranslation(sBase7, L3, 0, 0) hsolids2.append(geompy.MakePrismVecH(sBase8, oX, L4)) sBase9 = geompy.MakeTranslation(sBase8, L4, 0, 0) hsolids2.append(geompy.MakePrismVecH(sBase9, oX, L5)) sBase10= geompy.MakeTranslation(sBase9,L5, 0, 0) hsolids2.append(geompy.MakePrismVecH(sBase10, oX, L6)) # # Domain # dom_v2 = geompy.MakeCompound(hsolids2) dom_comp = geompy.MakeGlueFaces(dom_v2,1.0E-6) return dom_comp