Salome HOME
23264: [CEA 1815] Help Create field
authoreap <eap@opencascade.com>
Wed, 11 May 2016 10:25:47 +0000 (13:25 +0300)
committereap <eap@opencascade.com>
Wed, 11 May 2016 10:25:47 +0000 (13:25 +0300)
doc/salome/examples/CMakeLists.txt
doc/salome/examples/CTestTestfileInstall.cmake
doc/salome/examples/GEOM_Field.py [new file with mode: 0644]
doc/salome/gui/GEOM/images/create_field_dlg.png [new file with mode: 0644]
doc/salome/gui/GEOM/input/geom_field.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/index.doc

index c09d54e9603c7945bec80f28b65e89255f439d52..8a6f0cbd0b24bfc02e53386a58b8d7ac029beb52 100644 (file)
@@ -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
index 0b25d65ff2e126eccfdf576a388f6ac9709eb9a0..52755f01b909e91cc662eb4faeb88a1f4bc0a5b9 100644 (file)
@@ -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 (file)
index 0000000..930ce1c
--- /dev/null
@@ -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 (file)
index 0000000..bc0402f
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 (file)
index 0000000..fca16aa
--- /dev/null
@@ -0,0 +1,91 @@
+/*!
+
+\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 <b>Main Menu</b> select <b>New Entity ->
+  Field -> Create Field</b>.
+
+\image html create_field_dlg.png "Create Field dialog"
+
+In this dialog you can:
+<ul>
+  <li>Set <b>Field Name</b> with which a field will appear in the Object
+    Browser.</li>
+  <li>Select a \b Shape to which the field values will be assigned.</li>
+  <li>Select a \b Type of field values.</li>
+  <li>Select a type of \b Sub-shapes to assign values to.</li>
+  <li>Specify <b>Nb. Components</b> per a shape/sub-shape.
+  <li>Specify names of components and the values in a table of \b
+    Values. (To change a component name, double-click a column header).</li>
+  <li>Push <b>Add Step</b> button to add a new time step. (Specify a
+    step ID in \b Step field before pushing this button).</li>
+  <li>Adjust a time stamp number in \b Stamp field.<li>
+  <li>Push <b>Previous Step</b> and <b>Next Step</b> buttons to
+    navigate through added steps or use a drop-down list to the right
+    of the \b Step field to select a step by its ID.</li>
+  <li>Push <b>Remove Step</b> to delete a current step.</li>
+  <li>Push \b Apply or <b>Apply and Close</b> button to commit
+    creation of the field.<li>
+</ul>
+
+Later you can modify the values and the time stamp number of a created
+field and to add/remove steps to it. To do it, choose <b>Edit
+  Field</b> in a contextual menu of a field or step in the Object Browser.
+
+
+<b>Python API</b> for field manipulations includes the following commands:
+
+<pre>
+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)
+</pre>
+
+
+*/
index df3131feb77435d18761ee6e0a7f00a1f6872b36..78af35a8b51252dbe6969270cd78bbb6d7572678 100644 (file)
@@ -17,6 +17,7 @@
 - viewing information about geometrical objects using
   \subpage using_measurement_tools_page "measurement tools";
 - \subpage pictures_page "designing shapes from pictures";
+- \subpage geom_field_page "defining fields".
 
 It is possible to easily set parameters via the variables predefined in
   \subpage using_notebook_geom_page "SALOME notebook".