geom/doc/salome/gui/GEOM/input/tui_free_boundaries.doc

86 lines
2.0 KiB
Plaintext
Raw Normal View History

2012-04-18 15:17:03 +06:00
/*!
\page tui_free_boundaries_page Check Free Boundaries
\code
import os
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create boxes
box1 = geompy.MakeBox(0,0,0,100,50,100)
box2 = geompy.MakeBox(100,0,0,250,50,100)
# make a compound
compound = geompy.MakeCompound([box1, box2])
# import from *.brep
ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep")
# get a face
faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"])
# get the free boundary for face 32
Res = geompy.GetFreeBoundary(faces[32])
isSuccess = Res[0]
ClosedWires = Res[1]
OpenWires = Res[2]
if isSuccess == 1 :
print "Checking free boudaries is OK."
else :
print "Checking free boudaries is KO!"
print "len(ClosedWires) = ", len(ClosedWires)
i = 0
for wire in ClosedWires :
wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1)
geompy.addToStudy(ClosedWires[i], wire_name)
if i < len(ClosedWires) :
i = i+ 1
print "len(OpenWires) = ", len(OpenWires)
i = 0
for wire in OpenWires :
wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1)
geompy.addToStudy(OpenWires[i], wire_name)
if i < len(OpenWires) :
i = i+ 1
# get the free boundary for face 41
Res = geompy.GetFreeBoundary(faces[41])
isSuccess = Res[0]
ClosedWires = Res[1]
OpenWires = Res[2]
if isSuccess == 1 :
print "Checking free boudaries is OK."
else :
print "Checking free boudaries is KO!"
print "len(ClosedWires) = ", len(ClosedWires)
i = 0
for wire in ClosedWires :
wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1)
geompy.addToStudy(ClosedWires[i], wire_name)
if i < len(ClosedWires) :
i = i+ 1
print "len(OpenWires) = ", len(OpenWires)
i = 0
for wire in OpenWires :
wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1)
geompy.addToStudy(OpenWires[i], wire_name)
if i < len(OpenWires) :
i = i+ 1
# add the imported object to the study
id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP")
salome.sg.updateObjBrowser(1)
\endcode
*/