6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI(
"GEOM")
11 shape = geompy.MakeBoxDXDYDZ( 1, 1, 1, theName=
"box")
16 componentNames = [
'ID']
17 fieldDataType = GEOM.FDT_String
22 values = [str(i)
for i
in geompy.SubShapeAllIDs( shape, geompy.ShapeType[
"VERTEX"] )]
23 f0 = geompy.CreateField( shape,
"vertices", fieldDataType, dim, componentNames )
24 s0 = f0.addStep( stepID, stamp, values )
25 geompy.addToStudyInFather( shape, f0, f0.GetName() )
26 s0id = geompy.addToStudyInFather( f0, s0, s0.GetName() )
29 values = [str(i)
for i
in geompy.SubShapeAllIDs( shape, geompy.ShapeType[
"EDGE"] )]
30 f1 = geompy.CreateField( shape,
"edges", fieldDataType, dim, componentNames )
31 s1 = f1.addStep( stepID, stamp, values )
32 geompy.addToStudyInFather( shape, f1, f1.GetName() )
33 geompy.addToStudyInFather( f1, s1, s1.GetName() )
36 values = [str(i)
for i
in geompy.SubShapeAllIDs( shape, geompy.ShapeType[
"FACE"] )]
37 f2 = geompy.CreateField( shape,
"faces", fieldDataType, dim, componentNames )
38 s2 = f2.addStep( stepID, stamp, values )
39 geompy.addToStudyInFather( shape, f2, f2.GetName() )
40 geompy.addToStudyInFather( f2, s2, s2.GetName() )
43 values = [str(i)
for i
in geompy.SubShapeAllIDs( shape, geompy.ShapeType[
"SOLID"] )]
44 f3 = geompy.CreateField( shape,
"solids", fieldDataType, dim, componentNames )
45 s3 = f3.addStep( stepID, stamp, values )
46 geompy.addToStudyInFather( shape, f3, f3.GetName() )
47 geompy.addToStudyInFather( f3, s3, s3.GetName() )
50 f_1 = geompy.CreateField( shape,
"whole shape", fieldDataType, dim, componentNames )
51 s_1 = f_1.addStep(stepID, stamp, [
"1"])
52 geompy.addToStudyInFather( shape, f_1, f_1.GetName() )
53 geompy.addToStudyInFather( f_1, s_1, s_1.GetName() )
56 gg.createAndDisplayGO( s0id )