mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
23264: [CEA 1815] Help Create field
This commit is contained in:
parent
2894f56511
commit
33491a4d6e
@ -131,6 +131,7 @@ SET(GOOD_TESTS
|
|||||||
working_with_groups_ex04.py
|
working_with_groups_ex04.py
|
||||||
working_with_groups_ex05.py
|
working_with_groups_ex05.py
|
||||||
working_with_groups_ex06.py
|
working_with_groups_ex06.py
|
||||||
|
GEOM_Field.py
|
||||||
)
|
)
|
||||||
IF(CAS_VERSION_STR VERSION_GREATER "6.9.0")
|
IF(CAS_VERSION_STR VERSION_GREATER "6.9.0")
|
||||||
LIST(APPEND GOOD_TESTS
|
LIST(APPEND GOOD_TESTS
|
||||||
|
@ -130,6 +130,7 @@ SET(GOOD_TESTS
|
|||||||
working_with_groups_ex04
|
working_with_groups_ex04
|
||||||
working_with_groups_ex05
|
working_with_groups_ex05
|
||||||
working_with_groups_ex06
|
working_with_groups_ex06
|
||||||
|
GEOM_Field
|
||||||
)
|
)
|
||||||
# CAS_VERSION > "6.8.0"
|
# CAS_VERSION > "6.8.0"
|
||||||
LIST(APPEND GOOD_TESTS fast_intersection)
|
LIST(APPEND GOOD_TESTS fast_intersection)
|
||||||
|
56
doc/salome/examples/GEOM_Field.py
Normal file
56
doc/salome/examples/GEOM_Field.py
Normal file
@ -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 )
|
BIN
doc/salome/gui/GEOM/images/create_field_dlg.png
Normal file
BIN
doc/salome/gui/GEOM/images/create_field_dlg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
91
doc/salome/gui/GEOM/input/geom_field.doc
Normal file
91
doc/salome/gui/GEOM/input/geom_field.doc
Normal file
@ -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>
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
@ -17,6 +17,7 @@
|
|||||||
- viewing information about geometrical objects using
|
- viewing information about geometrical objects using
|
||||||
\subpage using_measurement_tools_page "measurement tools";
|
\subpage using_measurement_tools_page "measurement tools";
|
||||||
- \subpage pictures_page "designing shapes from pictures";
|
- \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
|
It is possible to easily set parameters via the variables predefined in
|
||||||
\subpage using_notebook_geom_page "SALOME notebook".
|
\subpage using_notebook_geom_page "SALOME notebook".
|
||||||
|
Loading…
Reference in New Issue
Block a user