diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index c09d54e96..8a6f0cbd0 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -131,6 +131,7 @@ SET(GOOD_TESTS working_with_groups_ex04.py working_with_groups_ex05.py working_with_groups_ex06.py + GEOM_Field.py ) IF(CAS_VERSION_STR VERSION_GREATER "6.9.0") LIST(APPEND GOOD_TESTS diff --git a/doc/salome/examples/CTestTestfileInstall.cmake b/doc/salome/examples/CTestTestfileInstall.cmake index 0b25d65ff..52755f01b 100644 --- a/doc/salome/examples/CTestTestfileInstall.cmake +++ b/doc/salome/examples/CTestTestfileInstall.cmake @@ -130,6 +130,7 @@ SET(GOOD_TESTS working_with_groups_ex04 working_with_groups_ex05 working_with_groups_ex06 + GEOM_Field ) # CAS_VERSION > "6.8.0" LIST(APPEND GOOD_TESTS fast_intersection) diff --git a/doc/salome/examples/GEOM_Field.py b/doc/salome/examples/GEOM_Field.py new file mode 100644 index 000000000..930ce1c31 --- /dev/null +++ b/doc/salome/examples/GEOM_Field.py @@ -0,0 +1,56 @@ +# Geom Field + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) +gg = salome.ImportComponentGUI("GEOM") + +# a box +shape = geompy.MakeBoxDXDYDZ( 1, 1, 1, theName="box") + +# Create fields holding sub-shape IDs as strings, +# which can be useful to see sub-shape IDs in the Viewer + +componentNames = ['ID'] +fieldDataType = GEOM.FDT_String +stepID = 0 +stamp = 0 + +dim = 0 # == vertices +values = [str(i) for i in geompy.SubShapeAllIDs( shape, geompy.ShapeType["VERTEX"] )] +f0 = geompy.CreateField( shape, "vertices", fieldDataType, dim, componentNames ) +s0 = f0.addStep( stepID, stamp, values ) +geompy.addToStudyInFather( shape, f0, f0.GetName() ) +s0id = geompy.addToStudyInFather( f0, s0, s0.GetName() ) + +dim = 1 # == edges +values = [str(i) for i in geompy.SubShapeAllIDs( shape, geompy.ShapeType["EDGE"] )] +f1 = geompy.CreateField( shape, "edges", fieldDataType, dim, componentNames ) +s1 = f1.addStep( stepID, stamp, values ) +geompy.addToStudyInFather( shape, f1, f1.GetName() ) +geompy.addToStudyInFather( f1, s1, s1.GetName() ) + +dim = 2 # == faces +values = [str(i) for i in geompy.SubShapeAllIDs( shape, geompy.ShapeType["FACE"] )] +f2 = geompy.CreateField( shape, "faces", fieldDataType, dim, componentNames ) +s2 = f2.addStep( stepID, stamp, values ) +geompy.addToStudyInFather( shape, f2, f2.GetName() ) +geompy.addToStudyInFather( f2, s2, s2.GetName() ) + +dim = 3 # == solids +values = [str(i) for i in geompy.SubShapeAllIDs( shape, geompy.ShapeType["SOLID"] )] +f3 = geompy.CreateField( shape, "solids", fieldDataType, dim, componentNames ) +s3 = f3.addStep( stepID, stamp, values ) +geompy.addToStudyInFather( shape, f3, f3.GetName() ) +geompy.addToStudyInFather( f3, s3, s3.GetName() ) + +dim = -1 # == whole shape +f_1 = geompy.CreateField( shape, "whole shape", fieldDataType, dim, componentNames ) +s_1 = f_1.addStep(stepID, stamp, ["1"]) +geompy.addToStudyInFather( shape, f_1, f_1.GetName() ) +geompy.addToStudyInFather( f_1, s_1, s_1.GetName() ) + +# display +gg.createAndDisplayGO( s0id ) diff --git a/doc/salome/gui/GEOM/images/create_field_dlg.png b/doc/salome/gui/GEOM/images/create_field_dlg.png new file mode 100644 index 000000000..bc0402f22 Binary files /dev/null and b/doc/salome/gui/GEOM/images/create_field_dlg.png differ diff --git a/doc/salome/gui/GEOM/input/geom_field.doc b/doc/salome/gui/GEOM/input/geom_field.doc new file mode 100644 index 000000000..0a1df0763 --- /dev/null +++ b/doc/salome/gui/GEOM/input/geom_field.doc @@ -0,0 +1,93 @@ +/*! + +\page geom_field_page Working with Fields + +A field object allows assigning some values to geometrical +entities. These values can be later transferred to mesh entities +generated on the geometrical entities during export to MED file in +Mesh module. Geometrical fields can be stored in/restored from +\ref io_xao "XAO format" files. + +A field object assigns values to either +- all vertices of a GEOM_Object or +- all edges of a GEOM_Object or +- all faces of a GEOM_Object or +- all solids of a GEOM_Object or +- the whole GEOM_Object. + +Values can be of one of the following types: +- boolean, +- integer, +- double, +- string. + +\note Only integer and double values can be exported into the MED file. + +The field can hold several named values (components) per a geometrical entity. + +The field can include several sets of data called \a steps, each + dedicated to a certain time moment. A step is described by + - an integer ID, + - a time stamp number, + - values. + +To create a field, in the Main Menu select New Entity -> + Field -> Create Field. + +\image html create_field_dlg.png "Create Field dialog" + +In this dialog you can: +
+field = geompy.CreateField(shape, name, type, dimension, componentNames) +geompy.RemoveField(field) +shape = field.getShape() +name = field.getName() +field.setName(name) +type = field.getType() +dim = field.getDimension() +componentNames = field.getComponents() +nbFileds = geompy.CountFields(shape) +fields = geompy.GetFields(shape) +field = geompy.GetField(shape, name) + +field.addStep(stepID, stamp, values) +field.removeStep(stepID) +nbSteps = field.countSteps() +stepIDs = field.getSteps() +stamp = field.getStamp(stepID) +field.setStamp(stepID, stamp) +values = field.getValues(stepID) +field.setValues(step, values) ++ +Our TUI Scripts provide you with examples of +\ref tui_geom_field_page "GEOM fields creation". + +*/ diff --git a/doc/salome/gui/GEOM/input/geompy.doc b/doc/salome/gui/GEOM/input/geompy.doc index a39809963..e6af9a43a 100644 --- a/doc/salome/gui/GEOM/input/geompy.doc +++ b/doc/salome/gui/GEOM/input/geompy.doc @@ -43,6 +43,7 @@ provided by Geometry module.