Exemple #1
0
    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
Exemple #2
0
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Sommet_1 = geompy.MakeVertex(0, 0, 0)
Sommet_2 = geompy.MakeVertex(Lplq, 0, 0)
Sommet_3 = geompy.MakeVertex(Lplq, lfin, 0)
Sommet_4 = geompy.MakeVertex(Lplq, lplq, 0)
Sommet_5 = geompy.MakeVertex(0, lplq, 0)
Sommet_6 = geompy.MakeVertex(0, lfin, 0)

Ligne_1 = geompy.MakeLineTwoPnt(Sommet_1, Sommet_2)
Ligne_2 = geompy.MakeLineTwoPnt(Sommet_2, Sommet_3)
Ligne_3 = geompy.MakeLineTwoPnt(Sommet_3, Sommet_6)
Ligne_4 = geompy.MakeLineTwoPnt(Sommet_1, Sommet_6)
Ligne_5 = geompy.MakeLineTwoPnt(Sommet_3, Sommet_4)
Ligne_6 = geompy.MakeLineTwoPnt(Sommet_4, Sommet_5)
Ligne_7 = geompy.MakeLineTwoPnt(Sommet_5, Sommet_6)
Face_1 = geompy.MakeFaceWires([Ligne_1, Ligne_2, Ligne_3, Ligne_4], 1)
Face_2 = geompy.MakeFaceWires([Ligne_3, Ligne_5, Ligne_6, Ligne_7], 1)
Plaque = geompy.MakeCompound([Face_1, Face_2])
Sym = geompy.CreateGroup(Plaque, geompy.ShapeType["EDGE"])
geompy.UnionIDs(Sym, [4])
gauche = geompy.CreateGroup(Plaque, geompy.ShapeType["EDGE"])
geompy.UnionIDs(gauche, [7])
droite = geompy.CreateGroup(Plaque, geompy.ShapeType["EDGE"])
geompy.UnionIDs(droite, [11])
Fin = geompy.CreateGroup(Plaque, geompy.ShapeType["FACE"])
geompy.UnionIDs(Fin, [2])
centre = geompy.CreateGroup(Plaque, geompy.ShapeType["EDGE"])
geompy.UnionIDs(centre, [4, 9])
ext = geompy.CreateGroup(Plaque, geompy.ShapeType["EDGE"])
geompy.UnionIDs(ext, [19])
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
Ligne_3 = geompy.MakeLineTwoPnt(Sommet_10, Sommet_11)
Ligne_4 = geompy.MakeLineTwoPnt(Sommet_12, Sommet_13)

Arc_1 = geompy.MakeArcCenter(Sommet_9, Sommet_8, Sommet_15, False)
Arc_2 = geompy.MakeArcCenter(Sommet_9, Sommet_15, Sommet_10, False)
Arc_3 = geompy.MakeArcCenter(Sommet_10, Sommet_11, Sommet_16, False)
Arc_4 = geompy.MakeArcCenter(Sommet_10, Sommet_16, Sommet_12, False)
Arc_5 = geompy.MakeArcCenter(Sommet_1, Sommet_3, Sommet_4, False)
Arc_6 = geompy.MakeArcCenter(Sommet_1, Sommet_4, Sommet_5, False)
Arc_7 = geompy.MakeArcCenter(Sommet_1, Sommet_5, Sommet_6, False)
Arc_8 = geompy.MakeArcCenter(Sommet_1, Sommet_6, Sommet_3, False)
Arc_9 = geompy.MakeArcCenter(Sommet_1, Sommet_13, Sommet_14, False)
Arc_10 = geompy.MakeArcCenter(Sommet_1, Sommet_14, Sommet_2, False)

Crochet = geompy.MakeFaceWires([
    Ligne_1, Ligne_2, Ligne_3, Ligne_4, Arc_1, Arc_2, Arc_3, Arc_4, Arc_5,
    Arc_6, Arc_7, Arc_8, Arc_9, Arc_10
], 1)

geompy.addToStudy(O, 'O')
geompy.addToStudy(OX, 'OX')
geompy.addToStudy(OY, 'OY')
geompy.addToStudy(OZ, 'OZ')
geompy.addToStudy(Sommet_1, 'Sommet_1')
geompy.addToStudy(Sommet_2, 'Sommet_2')
geompy.addToStudy(Sommet_3, 'Sommet_3')
geompy.addToStudy(Sommet_4, 'Sommet_4')
geompy.addToStudy(Sommet_5, 'Sommet_5')
geompy.addToStudy(Sommet_6, 'Sommet_6')
geompy.addToStudy(Sommet_7, 'Sommet_7')
geompy.addToStudy(Sommet_8, 'Sommet_8')
geompy.addToStudy(Sommet_9, 'Sommet_9')
geompy.init_geom(theStudy)

O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Sommet_1 = geompy.MakeVertex(0, 0, 0)
Sommet_2 = geompy.MakeVertex(1, 0, 0)
Sommet_3 = geompy.MakeVertex(1, 1, 0)
Sommet_4 = geompy.MakeVertex(0, 1, 0)
Ligne_1 = geompy.MakeLineTwoPnt(Sommet_1, Sommet_2)
Ligne_2 = geompy.MakeLineTwoPnt(Sommet_2, Sommet_3)
Ligne_3 = geompy.MakeLineTwoPnt(Sommet_3, Sommet_4)
Ligne_4 = geompy.MakeLineTwoPnt(Sommet_4, Sommet_1)
Plaque = geompy.MakeFaceWires([Ligne_1, Ligne_2, Ligne_3, Ligne_4], 1)
listSubShapeIDs = geompy.SubShapeAllIDs(Plaque, geompy.ShapeType["EDGE"])
BORD = geompy.CreateGroup(Plaque, geompy.ShapeType["EDGE"])
geompy.UnionIDs(BORD, [3, 6, 8, 10])
geomObj_1 = geompy.GetSubShape(Plaque, [3])
geompy.addToStudy(O, 'O')
geompy.addToStudy(OX, 'OX')
geompy.addToStudy(OY, 'OY')
geompy.addToStudy(OZ, 'OZ')
geompy.addToStudy(Sommet_1, 'Sommet_1')
geompy.addToStudy(Sommet_2, 'Sommet_2')
geompy.addToStudy(Sommet_3, 'Sommet_3')
geompy.addToStudy(Sommet_4, 'Sommet_4')
geompy.addToStudy(Ligne_1, 'Ligne_1')
geompy.addToStudy(Ligne_2, 'Ligne_2')
geompy.addToStudy(Ligne_3, 'Ligne_3')
Exemple #6
0
Cercle_1 = geompy.MakeCircle(Sommet_6, Ligne_2, Rp)
Extrusion_1 = geompy.MakePrismVecH(Cercle_1, Ligne_2, 100)
Cercle_2 = geompy.MakeCircle(Sommet_6, Ligne_2, Rbri)


Ligne_3 = geompy.MakeLineTwoPnt(Sommet_9, Sommet_10)
Ligne_4 = geompy.MakeLineTwoPnt(Sommet_10, Sommet_11)
Ligne_5 = geompy.MakeLineTwoPnt(Sommet_11, Sommet_12)
Ligne_6 = geompy.MakeLineTwoPnt(Sommet_9, Sommet_12)

Ligne_7 = geompy.MakeLineTwoPnt(Sommet_13, Sommet_14)
Ligne_8 = geompy.MakeLineTwoPnt(Sommet_14, Sommet_15)
Ligne_9 = geompy.MakeLineTwoPnt(Sommet_15, Sommet_16)
Ligne_10 = geompy.MakeLineTwoPnt(Sommet_16, Sommet_13)

Face_1 = geompy.MakeFaceWires([Cercle_1, Cercle_2], 1)
Face_15 = geompy.MakeFaceWires([Ligne_3, Ligne_4, Ligne_5, Ligne_6], 1)
Face_16 = geompy.MakeFaceWires([Ligne_7, Ligne_8, Ligne_9, Ligne_10], 1)

Partition_1 = geompy.MakePartition([Extrusion_1], [R_volution_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[Partition_2,Face_3] = geompy.ExtractShapes(Partition_1, geompy.ShapeType["FACE"], True)
Partition_2 = geompy.MakePartition([R_volution_1], [Extrusion_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[Face_2,Face_4,Partition_3,Face_5,Face_7] = geompy.ExtractShapes(Partition_2, geompy.ShapeType["FACE"], True)
Partition_3 = geompy.MakePartition([Face_15, Face_16], [Partition_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[Face_5,Virole,Face_8,Fonds] = geompy.ExtractShapes(Partition_3, geompy.ShapeType["FACE"], True)
Virole = geompy.MakeCompound([Face_4])
Fonds = geompy.MakeCompound([Face_2, Face_7])
Piquage = geompy.MakeCompound([Face_1, Face_3])
Supports = geompy.MakeCompound([Face_5, Face_8])
ViroleS = geompy.MakeFuse(Virole, Supports)
Bidon = geompy.MakeCompound([Fonds, Piquage, ViroleS])
    def generateFilmGeometry(self):
        if self.percentageCoverage < 0:
            print "Error: Cannot compute negative coverage percentages!!!"
            raise Exception
        elif self.percentageCoverage < 100:
            theta = (math.pi) * float(self.percentageCoverage / 100)
            zetha = theta / 2 + self.filmOrient[0] - (math.pi) / 2
            gamma = self.filmOrient[0] - theta / 2
            print theta, zetha, gamma
            arc1Pt1 = [
                -math.sin(zetha) * self.radius + self.position[0],
                math.cos(zetha) * self.radius + self.position[1],
                self.position[2]
            ]
            arc1Pt2 = [
                math.sin(gamma) * self.radius + self.position[0],
                math.cos(gamma) * self.radius + self.position[1],
                self.position[2]
            ]

            arc2Pt1 = [
                arc1Pt1[0] - math.sin(zetha) * self.filmThickness,
                arc1Pt1[1] + math.cos(zetha) * self.filmThickness, arc1Pt1[2]
            ]
            arc2Pt2 = [
                arc1Pt2[0] + math.sin(gamma) * self.filmThickness,
                arc1Pt2[1] + math.cos(gamma) * self.filmThickness, arc1Pt2[2]
            ]

            circleCentre = geompy.MakeVertex(self.position[0],
                                             self.position[1],
                                             self.position[2])

            arc1V1 = geompy.MakeVertex(arc1Pt1[0], arc1Pt1[1], arc1Pt1[2])
            arc1V2 = geompy.MakeVertex(arc1Pt2[0], arc1Pt2[1], arc1Pt2[2])

            arc2V1 = geompy.MakeVertex(arc2Pt1[0], arc2Pt1[1], arc2Pt1[2])
            arc2V2 = geompy.MakeVertex(arc2Pt2[0], arc2Pt2[1], arc2Pt2[2])

            print arc1Pt1, arc1Pt2, arc2Pt1, arc2Pt2
            arc1 = geompy.MakeArcCenter(circleCentre, arc1V1, arc1V2)
            arc2 = geompy.MakeArcCenter(circleCentre, arc2V1, arc2V2)

            line1 = geompy.MakeLineTwoPnt(arc1V1, arc2V1)
            line2 = geompy.MakeLineTwoPnt(arc1V2, arc2V2)

            face1 = geompy.MakeFaceWires([arc1, arc2, line1, line2], 1)

            circleVector = geompy.MakeVectorDXDYDZ(self.filmOrient[0],
                                                   self.filmOrient[1],
                                                   self.filmOrient[2])
            circle1 = geompy.MakeCircle(circleCentre, circleVector,
                                        self.radius)

            self.__ionomerPipe = geompy.MakePipe(face1, circle1)
        elif self.percentageCoverage == 100:
            circleCentre = geompy.MakeVertex(self.position[0],
                                             self.position[1],
                                             self.position[2])
            circle1 = geompy.MakeCircle(circleCentre, None, self.radius)
            circle2 = geompy.MakeCircle(circleCentre, None,
                                        self.radius + self.filmThickness)
            face1 = geompy.MakeFaceWires([circle1, circle2], 1)
            vector1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
            circle3 = geompy.MakeCircle(circleCentre, vector1, 1)
            self.__ionomerPipe = geompy.MakePipe(face1, circle3)