Merge remote branch 'origin/V7_dev'

This commit is contained in:
vsr 2016-05-24 18:14:54 +03:00
commit 1f3630e04d
9 changed files with 160 additions and 1 deletions

View 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

View 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)

View 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 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -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 <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>
Our <b>TUI Scripts</b> provide you with examples of
\ref tui_geom_field_page "GEOM fields creation".
*/

View File

@ -43,6 +43,7 @@ provided by Geometry module.
<li>\ref tui_blocks_operations_page</li>
<li>\ref tui_repairing_operations_page</li>
</ul>
<li>\subpage tui_geom_field_page</li>
<li>\subpage tui_measurement_tools_page</li>
<li>\subpage tui_notebook_geom_page</li>
<li>\subpage tui_arranging_study_objects_page</li>

View 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".

View File

@ -0,0 +1,6 @@
/*!
\page tui_geom_field_page Geometrical Fields
\tui_script{GEOM_Field.py}
*/

View File

@ -1048,7 +1048,7 @@ GetCreationInformation(std::string& theOperationName,
AddParam( theParams, "Operation", op );
for ( int iP = aParams->Lower(), nbP = aParams->Upper(); iP <= nbP; ++iP )
{
const TCollection_ExtendedString& par = aParams->Value(i);
const TCollection_ExtendedString& par = aParams->Value(iP);
TCollection_AsciiString parAscii( par );
if ( par.Search( op ) == 1 && parAscii.Value( op.Length() + 1 ) == '.' )
{