Changes for bug 0020671.
BIN
doc/salome/gui/SMESH/images/scale01.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
doc/salome/gui/SMESH/images/scale02.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
doc/salome/gui/SMESH/images/scale03.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
doc/salome/gui/SMESH/images/scale04.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
doc/salome/gui/SMESH/images/scale06.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
doc/salome/gui/SMESH/images/scale07.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
doc/salome/gui/SMESH/images/scale09.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
doc/salome/gui/SMESH/images/scaleinit01.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
doc/salome/gui/SMESH/images/scaleinit02.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
doc/salome/gui/SMESH/images/scaleres03.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
doc/salome/gui/SMESH/images/scaleres04.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
doc/salome/gui/SMESH/images/scaleres06.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
doc/salome/gui/SMESH/images/scaleres07.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
doc/salome/gui/SMESH/images/scaleres09.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
@ -18,6 +18,7 @@ elements of the mesh.</li>
|
||||
its elements.</li>
|
||||
<li>\subpage rotation_page "Rotate" by the indicated axis and angle
|
||||
the mesh or some of its elements.</li>
|
||||
<li>\subpage scale_page "Scale Transform" the mesh or some of its elements.</li>
|
||||
<li>Create a \subpage symmetry_page "symmetrical copy" of the mesh
|
||||
through a point or a vector of symmetry.</li>
|
||||
<li>Unite meshes by \subpage sewing_meshes_page "sewing" free borders,
|
||||
|
132
doc/salome/gui/SMESH/input/scale.doc
Normal file
@ -0,0 +1,132 @@
|
||||
/*!
|
||||
|
||||
\page scale_page Scale
|
||||
|
||||
\n This geometrical operation allows to scale in space your mesh
|
||||
or some of its elements.
|
||||
|
||||
<em>To scale a mesh:</em>
|
||||
|
||||
<ol>
|
||||
<li>From the \b Modification menu choose \b Transformation -> \b Scale
|
||||
\b Transform item.
|
||||
|
||||
One of the following dialogs will appear:
|
||||
|
||||
With one scale factor:
|
||||
\image html scale01.png
|
||||
|
||||
Or with different scale factors for axises:
|
||||
\image html scale02.png
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
In the dialog:
|
||||
<ul>
|
||||
<li>specify the IDs of the translated elements:
|
||||
|
||||
<ul>
|
||||
<li><b>Select the whole mesh, submesh or group</b> activating this
|
||||
checkbox; or</li>
|
||||
<li>choose mesh elements with the mouse in the 3D Viewer. It is
|
||||
possible to select a whole area with a mouse frame; or</li>
|
||||
<li>input the element IDs directly in <b>ID Elements</b> field. The selected elements will be highlighted in the
|
||||
viewer; or</li>
|
||||
<li>apply Filters. <b>Set filter</b> button allows to apply a filter to the selection of elements. See more
|
||||
about filters in the \ref selection_filter_library_page "Selection filter library" page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>specify the base point for scale</li>
|
||||
|
||||
<li>specify the scale factor</li>
|
||||
|
||||
<li>specify the conditions of scale:
|
||||
<ul>
|
||||
<li>activate <b>Move elements</b> radio button to create the source
|
||||
mesh (or elements) at the new location and erase it from the previous location;</li>
|
||||
<li>activate <b>Copy elements</b> radio button to create the source
|
||||
mesh (or elements) at the new location, but leave it at the previous
|
||||
location, the source mesh will be considered one and single mesh with the result of the rotation;</li>
|
||||
<li>activate <b>Create as new mesh</b> radio button to leave the
|
||||
source mesh (or elements) at its previous location and create a new
|
||||
mesh at the new location, the new mesh appears in the Object Browser
|
||||
with the default name MeshName_rotated (it is possible to change this
|
||||
name in the adjacent box);</li>
|
||||
<li>activate <b> Copy groups </b> checkbox to copy the groups of elements of the source mesh to the newly created mesh.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</li>
|
||||
|
||||
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<b>Examle of using:</b>
|
||||
|
||||
1. Create quandrangle mesh 3x3 on simple planar face (200x200)
|
||||
|
||||
\image html scaleinit01.png
|
||||
|
||||
and union 3 face (along axis Z) to group "gr_faces"
|
||||
|
||||
\image html scaleinit02.png
|
||||
|
||||
|
||||
|
||||
2. Perform scale opration for whole mesh with creation of new mesh:
|
||||
|
||||
\image html scale03.png
|
||||
|
||||
result after operation:
|
||||
|
||||
\image html scaleres03.png
|
||||
|
||||
|
||||
|
||||
3. Perform scale operation for whole mesh with copy of elements:
|
||||
|
||||
\image html scale04.png
|
||||
|
||||
result after operation:
|
||||
|
||||
\image html scaleres04.png
|
||||
|
||||
|
||||
|
||||
4. Perform scale opration for group of faces with copy of elements:
|
||||
|
||||
\image html scale06.png
|
||||
|
||||
result after operation:
|
||||
|
||||
\image html scaleres06.png
|
||||
|
||||
|
||||
|
||||
5. Perform scale opration for two edges with moving of elements:
|
||||
|
||||
\image html scale07.png
|
||||
|
||||
result after operation:
|
||||
|
||||
\image html scaleres07.png
|
||||
|
||||
|
||||
|
||||
6. Perform scale opration for one face with moving of elements:
|
||||
|
||||
\image html scale09.png
|
||||
|
||||
result after operation:
|
||||
|
||||
\image html scaleres09.png
|
||||
|
||||
|
||||
<br><b>See Also</b> a sample TUI Script of a \ref tui_scale "Scale" operation.
|
||||
|
||||
|
||||
*/
|
@ -44,6 +44,37 @@ angle270 = 1.5 * math.pi
|
||||
mesh.Rotate([], axisXYZ, angle270, 1)
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_scale
|
||||
<h3>Scale</h3>
|
||||
|
||||
\code
|
||||
import geompy
|
||||
Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||
f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"])
|
||||
|
||||
import smesh,SMESH
|
||||
import StdMeshers
|
||||
Mesh1 = smesh.Mesh(f[0])
|
||||
Regular_1D = Mesh1.Segment()
|
||||
Nb_Segments_1 = Regular_1D.NumberOfSegments(3)
|
||||
Nb_Segments_1.SetDistrType( 0 )
|
||||
Quadrangle_2D = Mesh1.Quadrangle()
|
||||
isDone = Mesh1.Compute()
|
||||
|
||||
#Perform scale opration for whole mesh with creation of new mesh
|
||||
newMesh = Mesh1.ScaleMakeMesh(Mesh1,SMESH.PointStruct(100,100,200),[0.5,0.3,0.7],True,"ScaledMesh")
|
||||
|
||||
#Perform scale operation for whole mesh with copy of elements
|
||||
Mesh1.Scale(Mesh1,SMESH.PointStruct(200,100,100),[0.5,0.5,0.5],True,True)
|
||||
|
||||
#Perform scale opration for two edges with moving of elements
|
||||
Mesh1.Scale([1,2],SMESH.PointStruct(-100,100,100),[0.8,1.0,0.7],False)
|
||||
|
||||
#Perform scale opration for one face with moving of elements
|
||||
Mesh1.Scale([21],SMESH.PointStruct(0,200,200),[0.7,0.7,0.7],False)
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_symmetry
|
||||
<h3>Symmetry</h3>
|
||||
|
@ -570,6 +570,19 @@ module SMESH
|
||||
in boolean CopyGroups,
|
||||
in string MeshName);
|
||||
|
||||
void Scale (in SMESH_IDSource theObject,
|
||||
in PointStruct thePoint,
|
||||
in double_array theScaleFact,
|
||||
in boolean Copy);
|
||||
ListOfGroups ScaleMakeGroups (in SMESH_IDSource theObject,
|
||||
in PointStruct thePoint,
|
||||
in double_array theScaleFact);
|
||||
SMESH_Mesh ScaleMakeMesh (in SMESH_IDSource theObject,
|
||||
in PointStruct thePoint,
|
||||
in double_array theScaleFact,
|
||||
in boolean CopyGroups,
|
||||
in string MeshName);
|
||||
|
||||
void Rotate (in long_array IDsOfElements,
|
||||
in AxisStruct Axis,
|
||||
in double AngleInRadians,
|
||||
|
@ -167,7 +167,9 @@ dist_salomeres_DATA = \
|
||||
mesh_extractGroup.png \
|
||||
mesh_precompute.png \
|
||||
mesh_2d_from_3d.png \
|
||||
mesh_free_faces.png
|
||||
mesh_free_faces.png \
|
||||
scale.png \
|
||||
scale_along_axes.png
|
||||
|
||||
# VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive
|
||||
nodist_salomeres_SCRIPTS = SMESHCatalog.xml
|
||||
|
BIN
resources/scale.png
Normal file
After Width: | Height: | Size: 885 B |
BIN
resources/scale_along_axes.png
Normal file
After Width: | Height: | Size: 874 B |
@ -4936,6 +4936,331 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
||||
return newGroupIDs;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Scale
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_MeshEditor::PGroupIDs
|
||||
SMESH_MeshEditor::Scale (TIDSortedElemSet & theElems,
|
||||
const gp_Pnt& thePoint,
|
||||
const std::list<double>& theScaleFact,
|
||||
const bool theCopy,
|
||||
const bool theMakeGroups,
|
||||
SMESH_Mesh* theTargetMesh)
|
||||
{
|
||||
myLastCreatedElems.Clear();
|
||||
myLastCreatedNodes.Clear();
|
||||
|
||||
SMESH_MeshEditor targetMeshEditor( theTargetMesh );
|
||||
SMESHDS_Mesh* aTgtMesh = theTargetMesh ? theTargetMesh->GetMeshDS() : 0;
|
||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||
|
||||
double scaleX=1.0, scaleY=1.0, scaleZ=1.0;
|
||||
std::list<double>::const_iterator itS = theScaleFact.begin();
|
||||
scaleX = (*itS);
|
||||
if(theScaleFact.size()==1) {
|
||||
scaleY = (*itS);
|
||||
scaleZ= (*itS);
|
||||
}
|
||||
if(theScaleFact.size()==2) {
|
||||
itS++;
|
||||
scaleY = (*itS);
|
||||
scaleZ= (*itS);
|
||||
}
|
||||
if(theScaleFact.size()>2) {
|
||||
itS++;
|
||||
scaleY = (*itS);
|
||||
itS++;
|
||||
scaleZ= (*itS);
|
||||
}
|
||||
|
||||
// map old node to new one
|
||||
TNodeNodeMap nodeMap;
|
||||
|
||||
// elements sharing moved nodes; those of them which have all
|
||||
// nodes mirrored but are not in theElems are to be reversed
|
||||
TIDSortedElemSet inverseElemSet;
|
||||
|
||||
// source elements for each generated one
|
||||
SMESH_SequenceOfElemPtr srcElems, srcNodes;
|
||||
|
||||
// loop on theElems
|
||||
TIDSortedElemSet::iterator itElem;
|
||||
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) {
|
||||
const SMDS_MeshElement* elem = *itElem;
|
||||
if ( !elem )
|
||||
continue;
|
||||
|
||||
// loop on elem nodes
|
||||
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
|
||||
while ( itN->more() ) {
|
||||
|
||||
// check if a node has been already transformed
|
||||
const SMDS_MeshNode* node = cast2Node( itN->next() );
|
||||
pair<TNodeNodeMap::iterator,bool> n2n_isnew =
|
||||
nodeMap.insert( make_pair ( node, node ));
|
||||
if ( !n2n_isnew.second )
|
||||
continue;
|
||||
|
||||
//double coord[3];
|
||||
//coord[0] = node->X();
|
||||
//coord[1] = node->Y();
|
||||
//coord[2] = node->Z();
|
||||
//theTrsf.Transforms( coord[0], coord[1], coord[2] );
|
||||
double dx = (node->X() - thePoint.X()) * scaleX;
|
||||
double dy = (node->Y() - thePoint.Y()) * scaleY;
|
||||
double dz = (node->Z() - thePoint.Z()) * scaleZ;
|
||||
if ( theTargetMesh ) {
|
||||
//const SMDS_MeshNode * newNode = aTgtMesh->AddNode( coord[0], coord[1], coord[2] );
|
||||
const SMDS_MeshNode * newNode =
|
||||
aTgtMesh->AddNode( thePoint.X()+dx, thePoint.Y()+dy, thePoint.Z()+dz );
|
||||
n2n_isnew.first->second = newNode;
|
||||
myLastCreatedNodes.Append(newNode);
|
||||
srcNodes.Append( node );
|
||||
}
|
||||
else if ( theCopy ) {
|
||||
//const SMDS_MeshNode * newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
|
||||
const SMDS_MeshNode * newNode =
|
||||
aMesh->AddNode( thePoint.X()+dx, thePoint.Y()+dy, thePoint.Z()+dz );
|
||||
n2n_isnew.first->second = newNode;
|
||||
myLastCreatedNodes.Append(newNode);
|
||||
srcNodes.Append( node );
|
||||
}
|
||||
else {
|
||||
//aMesh->MoveNode( node, coord[0], coord[1], coord[2] );
|
||||
aMesh->MoveNode( node, thePoint.X()+dx, thePoint.Y()+dy, thePoint.Z()+dz );
|
||||
// node position on shape becomes invalid
|
||||
const_cast< SMDS_MeshNode* > ( node )->SetPosition
|
||||
( SMDS_SpacePosition::originSpacePosition() );
|
||||
}
|
||||
|
||||
// keep inverse elements
|
||||
//if ( !theCopy && !theTargetMesh && needReverse ) {
|
||||
// SMDS_ElemIteratorPtr invElemIt = node->GetInverseElementIterator();
|
||||
// while ( invElemIt->more() ) {
|
||||
// const SMDS_MeshElement* iel = invElemIt->next();
|
||||
// inverseElemSet.insert( iel );
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
// either create new elements or reverse mirrored ones
|
||||
//if ( !theCopy && !needReverse && !theTargetMesh )
|
||||
if ( !theCopy && !theTargetMesh )
|
||||
return PGroupIDs();
|
||||
|
||||
TIDSortedElemSet::iterator invElemIt = inverseElemSet.begin();
|
||||
for ( ; invElemIt != inverseElemSet.end(); invElemIt++ )
|
||||
theElems.insert( *invElemIt );
|
||||
|
||||
// replicate or reverse elements
|
||||
|
||||
enum {
|
||||
REV_TETRA = 0, // = nbNodes - 4
|
||||
REV_PYRAMID = 1, // = nbNodes - 4
|
||||
REV_PENTA = 2, // = nbNodes - 4
|
||||
REV_FACE = 3,
|
||||
REV_HEXA = 4, // = nbNodes - 4
|
||||
FORWARD = 5
|
||||
};
|
||||
int index[][8] = {
|
||||
{ 2, 1, 0, 3, 4, 0, 0, 0 }, // REV_TETRA
|
||||
{ 2, 1, 0, 3, 4, 0, 0, 0 }, // REV_PYRAMID
|
||||
{ 2, 1, 0, 5, 4, 3, 0, 0 }, // REV_PENTA
|
||||
{ 2, 1, 0, 3, 0, 0, 0, 0 }, // REV_FACE
|
||||
{ 2, 1, 0, 3, 6, 5, 4, 7 }, // REV_HEXA
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7 } // FORWARD
|
||||
};
|
||||
|
||||
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
|
||||
{
|
||||
const SMDS_MeshElement* elem = *itElem;
|
||||
if ( !elem || elem->GetType() == SMDSAbs_Node )
|
||||
continue;
|
||||
|
||||
int nbNodes = elem->NbNodes();
|
||||
int elemType = elem->GetType();
|
||||
|
||||
if (elem->IsPoly()) {
|
||||
// Polygon or Polyhedral Volume
|
||||
switch ( elemType ) {
|
||||
case SMDSAbs_Face:
|
||||
{
|
||||
vector<const SMDS_MeshNode*> poly_nodes (nbNodes);
|
||||
int iNode = 0;
|
||||
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
|
||||
while (itN->more()) {
|
||||
const SMDS_MeshNode* node =
|
||||
static_cast<const SMDS_MeshNode*>(itN->next());
|
||||
TNodeNodeMap::iterator nodeMapIt = nodeMap.find(node);
|
||||
if (nodeMapIt == nodeMap.end())
|
||||
break; // not all nodes transformed
|
||||
//if (needReverse) {
|
||||
// // reverse mirrored faces and volumes
|
||||
// poly_nodes[nbNodes - iNode - 1] = (*nodeMapIt).second;
|
||||
//} else {
|
||||
poly_nodes[iNode] = (*nodeMapIt).second;
|
||||
//}
|
||||
iNode++;
|
||||
}
|
||||
if ( iNode != nbNodes )
|
||||
continue; // not all nodes transformed
|
||||
|
||||
if ( theTargetMesh ) {
|
||||
myLastCreatedElems.Append(aTgtMesh->AddPolygonalFace(poly_nodes));
|
||||
srcElems.Append( elem );
|
||||
}
|
||||
else if ( theCopy ) {
|
||||
myLastCreatedElems.Append(aMesh->AddPolygonalFace(poly_nodes));
|
||||
srcElems.Append( elem );
|
||||
}
|
||||
else {
|
||||
aMesh->ChangePolygonNodes(elem, poly_nodes);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SMDSAbs_Volume:
|
||||
{
|
||||
// ATTENTION: Reversing is not yet done!!!
|
||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
|
||||
if (!aPolyedre) {
|
||||
MESSAGE("Warning: bad volumic element");
|
||||
continue;
|
||||
}
|
||||
|
||||
vector<const SMDS_MeshNode*> poly_nodes;
|
||||
vector<int> quantities;
|
||||
|
||||
bool allTransformed = true;
|
||||
int nbFaces = aPolyedre->NbFaces();
|
||||
for (int iface = 1; iface <= nbFaces && allTransformed; iface++) {
|
||||
int nbFaceNodes = aPolyedre->NbFaceNodes(iface);
|
||||
for (int inode = 1; inode <= nbFaceNodes && allTransformed; inode++) {
|
||||
const SMDS_MeshNode* node = aPolyedre->GetFaceNode(iface, inode);
|
||||
TNodeNodeMap::iterator nodeMapIt = nodeMap.find(node);
|
||||
if (nodeMapIt == nodeMap.end()) {
|
||||
allTransformed = false; // not all nodes transformed
|
||||
} else {
|
||||
poly_nodes.push_back((*nodeMapIt).second);
|
||||
}
|
||||
}
|
||||
quantities.push_back(nbFaceNodes);
|
||||
}
|
||||
if ( !allTransformed )
|
||||
continue; // not all nodes transformed
|
||||
|
||||
if ( theTargetMesh ) {
|
||||
myLastCreatedElems.Append(aTgtMesh->AddPolyhedralVolume(poly_nodes, quantities));
|
||||
srcElems.Append( elem );
|
||||
}
|
||||
else if ( theCopy ) {
|
||||
myLastCreatedElems.Append(aMesh->AddPolyhedralVolume(poly_nodes, quantities));
|
||||
srcElems.Append( elem );
|
||||
}
|
||||
else {
|
||||
aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Regular elements
|
||||
int* i = index[ FORWARD ];
|
||||
//if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes
|
||||
// if ( elemType == SMDSAbs_Face )
|
||||
// i = index[ REV_FACE ];
|
||||
// else
|
||||
// i = index[ nbNodes - 4 ];
|
||||
|
||||
if(elem->IsQuadratic()) {
|
||||
static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
|
||||
i = anIds;
|
||||
//if(needReverse) {
|
||||
// if(nbNodes==3) { // quadratic edge
|
||||
// static int anIds[] = {1,0,2};
|
||||
// i = anIds;
|
||||
// }
|
||||
// else if(nbNodes==6) { // quadratic triangle
|
||||
// static int anIds[] = {0,2,1,5,4,3};
|
||||
// i = anIds;
|
||||
// }
|
||||
// else if(nbNodes==8) { // quadratic quadrangle
|
||||
// static int anIds[] = {0,3,2,1,7,6,5,4};
|
||||
// i = anIds;
|
||||
// }
|
||||
// else if(nbNodes==10) { // quadratic tetrahedron of 10 nodes
|
||||
// static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
|
||||
// i = anIds;
|
||||
// }
|
||||
// else if(nbNodes==13) { // quadratic pyramid of 13 nodes
|
||||
// static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
|
||||
// i = anIds;
|
||||
// }
|
||||
// else if(nbNodes==15) { // quadratic pentahedron with 15 nodes
|
||||
// static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
|
||||
// i = anIds;
|
||||
// }
|
||||
// else { // nbNodes==20 - quadratic hexahedron with 20 nodes
|
||||
// static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
|
||||
// i = anIds;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
// find transformed nodes
|
||||
vector<const SMDS_MeshNode*> nodes(nbNodes);
|
||||
int iNode = 0;
|
||||
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
|
||||
while ( itN->more() ) {
|
||||
const SMDS_MeshNode* node =
|
||||
static_cast<const SMDS_MeshNode*>( itN->next() );
|
||||
TNodeNodeMap::iterator nodeMapIt = nodeMap.find( node );
|
||||
if ( nodeMapIt == nodeMap.end() )
|
||||
break; // not all nodes transformed
|
||||
nodes[ i [ iNode++ ]] = (*nodeMapIt).second;
|
||||
}
|
||||
if ( iNode != nbNodes )
|
||||
continue; // not all nodes transformed
|
||||
|
||||
if ( theTargetMesh ) {
|
||||
if ( SMDS_MeshElement* copy =
|
||||
targetMeshEditor.AddElement( nodes, elem->GetType(), elem->IsPoly() )) {
|
||||
myLastCreatedElems.Append( copy );
|
||||
srcElems.Append( elem );
|
||||
}
|
||||
}
|
||||
else if ( theCopy ) {
|
||||
if ( SMDS_MeshElement* copy = AddElement( nodes, elem->GetType(), elem->IsPoly() )) {
|
||||
myLastCreatedElems.Append( copy );
|
||||
srcElems.Append( elem );
|
||||
}
|
||||
}
|
||||
else {
|
||||
// reverse element as it was reversed by transformation
|
||||
if ( nbNodes > 2 )
|
||||
aMesh->ChangeElementNodes( elem, &nodes[0], nbNodes );
|
||||
}
|
||||
}
|
||||
|
||||
PGroupIDs newGroupIDs;
|
||||
|
||||
if ( theMakeGroups && theCopy ||
|
||||
theMakeGroups && theTargetMesh ) {
|
||||
string groupPostfix = "scaled";
|
||||
newGroupIDs = generateGroups( srcNodes, srcElems, groupPostfix, theTargetMesh );
|
||||
}
|
||||
|
||||
return newGroupIDs;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
/*!
|
||||
* \brief Create groups of elements made during transformation
|
||||
|
@ -359,6 +359,23 @@ public:
|
||||
// Move or copy theElements applying theTrsf to their nodes
|
||||
|
||||
|
||||
/*!
|
||||
* Generate new elements by extrusion of theElements
|
||||
* param theElems - list of elements for scale
|
||||
* param thePoint - base point for scale
|
||||
* param theScaleFact - scale factors for axises
|
||||
* param theCopy - allows copying the translated elements
|
||||
* param theMakeGroups - forces the generation of new groups from existing ones
|
||||
* param theTargetMesh - the name of the newly created mesh
|
||||
* return instance of Mesh class
|
||||
*/
|
||||
PGroupIDs Scale (TIDSortedElemSet& theElements,
|
||||
const gp_Pnt& thePoint,
|
||||
const std::list<double>& theScaleFact,
|
||||
const bool theCopy,
|
||||
const bool theMakeGroups,
|
||||
SMESH_Mesh* theTargetMesh=0);
|
||||
|
||||
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
|
||||
|
||||
void FindCoincidentNodes (std::set<const SMDS_MeshNode*> & theNodes,
|
||||
|
@ -71,6 +71,7 @@ salomeinclude_HEADERS = \
|
||||
SMESHGUI_RevolutionDlg.h \
|
||||
SMESHGUI_RotationDlg.h \
|
||||
SMESHGUI_TranslationDlg.h \
|
||||
SMESHGUI_ScaleDlg.h \
|
||||
SMESHGUI_SymmetryDlg.h \
|
||||
SMESHGUI_SewingDlg.h \
|
||||
SMESHGUI_EditMeshDlg.h \
|
||||
@ -134,6 +135,7 @@ dist_libSMESH_la_SOURCES = \
|
||||
SMESHGUI_RevolutionDlg.cxx \
|
||||
SMESHGUI_RotationDlg.cxx \
|
||||
SMESHGUI_TranslationDlg.cxx \
|
||||
SMESHGUI_ScaleDlg.cxx \
|
||||
SMESHGUI_SymmetryDlg.cxx \
|
||||
SMESHGUI_SewingDlg.cxx \
|
||||
SMESHGUI_EditMeshDlg.cxx \
|
||||
@ -203,6 +205,7 @@ MOC_FILES = \
|
||||
SMESHGUI_RevolutionDlg_moc.cxx \
|
||||
SMESHGUI_RotationDlg_moc.cxx \
|
||||
SMESHGUI_TranslationDlg_moc.cxx \
|
||||
SMESHGUI_ScaleDlg_moc.cxx \
|
||||
SMESHGUI_SymmetryDlg_moc.cxx \
|
||||
SMESHGUI_SewingDlg_moc.cxx \
|
||||
SMESHGUI_EditMeshDlg_moc.cxx \
|
||||
|
@ -69,6 +69,7 @@
|
||||
#include "SMESHGUI_StandardMeshInfosDlg.h"
|
||||
#include "SMESHGUI_SymmetryDlg.h"
|
||||
#include "SMESHGUI_TranslationDlg.h"
|
||||
#include "SMESHGUI_ScaleDlg.h"
|
||||
#include "SMESHGUI_TransparencyDlg.h"
|
||||
#include "SMESHGUI_WhatIsDlg.h"
|
||||
|
||||
@ -2632,6 +2633,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
startOperation( 4067 );
|
||||
break;
|
||||
|
||||
case 4068: // SCALE
|
||||
{
|
||||
if(checkLock(aStudy)) break;
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_ScaleDlg( this ) )->show();
|
||||
}
|
||||
else {
|
||||
SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
||||
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 5105: // Library of selection filters
|
||||
{
|
||||
static QList<int> aTypes;
|
||||
@ -2926,6 +2941,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createSMESHAction( 4065, "MERGE", "ICON_SMESH_MERGE_NODES" );
|
||||
createSMESHAction( 4066, "MERGE_ELEMENTS", "ICON_DLG_MERGE_ELEMENTS" );
|
||||
createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MESH_THROU_POINT" );
|
||||
createSMESHAction( 4068, "SCALE", "ICON_DLG_MESH_SCALE" );
|
||||
createSMESHAction( 406, "MOVE", "ICON_DLG_MOVE_NODE" );
|
||||
createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" );
|
||||
createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" );
|
||||
@ -3096,6 +3112,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createMenu( 4064, transfId, -1 );
|
||||
createMenu( 4065, transfId, -1 );
|
||||
createMenu( 4066, transfId, -1 );
|
||||
createMenu( 4068, transfId, -1 );
|
||||
|
||||
createMenu( 406, modifyId, -1 );
|
||||
createMenu( 4067,modifyId, -1 );
|
||||
@ -3194,6 +3211,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createTool( 4064, addRemTb );
|
||||
createTool( 4065, addRemTb );
|
||||
createTool( 4066, addRemTb );
|
||||
createTool( 4068, addRemTb );
|
||||
createTool( separator(), addRemTb );
|
||||
|
||||
createTool( 406, modifyTb );
|
||||
|
1058
src/SMESHGUI/SMESHGUI_ScaleDlg.cxx
Normal file
149
src/SMESHGUI/SMESHGUI_ScaleDlg.h
Normal file
@ -0,0 +1,149 @@
|
||||
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
// File : SMESHGUI_ScaleDlg.h
|
||||
// Author : Sergey Kuul, Open CASCADE S.A.S.
|
||||
//
|
||||
#ifndef SMESHGUI_SCALEDLG_H
|
||||
#define SMESHGUI_SCALEDLG_H
|
||||
|
||||
// SMESH includes
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QButtonGroup;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class QCheckBox;
|
||||
class SMESHGUI;
|
||||
class SMESHGUI_IdValidator;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SMESHGUI_FilterDlg;
|
||||
class SMESH_Actor;
|
||||
class SVTK_Selector;
|
||||
class LightApp_SelectionMgr;
|
||||
class SMESH_LogicalFilter;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_ScaleDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_ScaleDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_ScaleDlg( SMESHGUI* );
|
||||
~SMESHGUI_ScaleDlg();
|
||||
|
||||
private:
|
||||
void Init( bool = true );
|
||||
void closeEvent( QCloseEvent* );
|
||||
void enterEvent( QEvent* ); /* mouse enter the QWidget */
|
||||
void hideEvent( QHideEvent* ); /* ESC key */
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
int GetConstructorId();
|
||||
void setNewMeshName();
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
QString myElementsId;
|
||||
int myNbOkElements; /* to check when elements are defined */
|
||||
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
QWidget* myEditCurrentArgument;
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
|
||||
|
||||
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||
|
||||
QGroupBox* ConstructorsBox;
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* RadioButton1;
|
||||
QRadioButton* RadioButton2;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
QPushButton* buttonHelp;
|
||||
QGroupBox* GroupArguments;
|
||||
QLabel* TextLabelElements;
|
||||
QPushButton* SelectElementsButton;
|
||||
QLineEdit* LineEditElements;
|
||||
QCheckBox* CheckBoxMesh;
|
||||
QLabel* TextLabel1;
|
||||
QPushButton* SelectButton1;
|
||||
QLabel* TextLabel1_1;
|
||||
SMESHGUI_SpinBox* SpinBox1_1;
|
||||
QLabel* TextLabel1_2;
|
||||
SMESHGUI_SpinBox* SpinBox1_2;
|
||||
QLabel* TextLabel1_3;
|
||||
SMESHGUI_SpinBox* SpinBox1_3;
|
||||
QLabel* TextLabel2;
|
||||
SMESHGUI_SpinBox* SpinBox_FX;
|
||||
QLabel* TextLabel3;
|
||||
SMESHGUI_SpinBox* SpinBox_FY;
|
||||
QLabel* TextLabel4;
|
||||
SMESHGUI_SpinBox* SpinBox_FZ;
|
||||
QGroupBox* ActionBox;
|
||||
QButtonGroup* ActionGroup;
|
||||
QCheckBox* MakeGroupsCheck;
|
||||
QLineEdit* LineEditNewMesh;
|
||||
|
||||
QString myHelpFileName;
|
||||
|
||||
QPushButton* myFilterBtn;
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked( int );
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
bool ClickOnApply();
|
||||
void ClickOnHelp();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
void onTextChange( const QString& );
|
||||
void onSelectMesh( bool );
|
||||
void onActionClicked( int );
|
||||
void setFilters();
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_SCALEDLG_H
|
@ -373,6 +373,14 @@
|
||||
<source>ICON_SMESH_TRANSLATION_VECTOR</source>
|
||||
<translation>mesh_translation_vector.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_MESH_SCALE</source>
|
||||
<translation>scale.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_SCALE_ALONG_AXES</source>
|
||||
<translation>scale_along_axes.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_ALGO</source>
|
||||
<translation>mesh_tree_algo.png</translation>
|
||||
|
@ -642,6 +642,10 @@
|
||||
<source>MEN_TRANS</source>
|
||||
<translation>Translation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SCALE</source>
|
||||
<translation>Scale Transform</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_TRANSF</source>
|
||||
<translation>Transformation</translation>
|
||||
@ -1715,6 +1719,10 @@ add the exported data to its contents?</translation>
|
||||
<source>SMESH_POINT_2</source>
|
||||
<translation>Point 2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_BASE_POINT</source>
|
||||
<translation>Base Point</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_POLYEDRE_CREATE_ERROR</source>
|
||||
<translation>Polyedron creation error</translation>
|
||||
@ -1916,6 +1924,30 @@ add the exported data to its contents?</translation>
|
||||
<source>SMESH_TRANSLATION</source>
|
||||
<translation>Translation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_SCALE_TITLE</source>
|
||||
<translation>Scale Transform</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_SCALE</source>
|
||||
<translation>Scale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_SCALE_FACTOR</source>
|
||||
<translation>Scale Factor :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_SCALE_FACTOR_X</source>
|
||||
<translation>Scale Factor X :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_SCALE_FACTOR_Y</source>
|
||||
<translation>Scale Factor Y :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_SCALE_FACTOR_Z</source>
|
||||
<translation>Scale Factor Z :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_TRANSPARENCY_OPAQUE</source>
|
||||
<translation>---> Opaque</translation>
|
||||
@ -2492,6 +2524,10 @@ Consider saving your work before application crash</translation>
|
||||
<source>STB_TRANS</source>
|
||||
<translation>Translation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_SCALE</source>
|
||||
<translation>Scale Transform</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_TRANSP</source>
|
||||
<translation>Transparency</translation>
|
||||
@ -3002,6 +3038,10 @@ Consider saving your work before application crash</translation>
|
||||
<source>TOP_TRANS</source>
|
||||
<translation>Translation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_SCALE</source>
|
||||
<translation>Scale Transform</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_TRANSP</source>
|
||||
<translation>Transparency</translation>
|
||||
|
@ -279,7 +279,7 @@ void SMESH_MeshEditor_i::initData(bool deleteSearchers)
|
||||
struct _IDSource : public POA_SMESH::SMESH_IDSource
|
||||
{
|
||||
SMESH::long_array _ids;
|
||||
SMESH::long_array* GetIDs() { return & _ids; }
|
||||
SMESH::long_array* GetIDs() { return new SMESH::long_array( _ids ); }
|
||||
SMESH::long_array* GetMeshInfo() { return 0; }
|
||||
};
|
||||
|
||||
@ -3367,6 +3367,140 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
|
||||
return mesh._retn();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : scale
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::ListOfGroups*
|
||||
SMESH_MeshEditor_i::scale(const SMESH::long_array & theIDsOfElements,
|
||||
const SMESH::PointStruct& thePoint,
|
||||
const SMESH::double_array& theScaleFact,
|
||||
CORBA::Boolean theCopy,
|
||||
const bool theMakeGroups,
|
||||
::SMESH_Mesh* theTargetMesh)
|
||||
{
|
||||
initData();
|
||||
|
||||
TIDSortedElemSet elements;
|
||||
arrayToSet(theIDsOfElements, GetMeshDS(), elements);
|
||||
|
||||
gp_Pnt aPnt( thePoint.x, thePoint.y, thePoint.z );
|
||||
list<double> aScaleFact;
|
||||
for (int i = 0; i < theScaleFact.length(); i++) {
|
||||
aScaleFact.push_back( theScaleFact[i] );
|
||||
}
|
||||
|
||||
::SMESH_MeshEditor anEditor( myMesh );
|
||||
::SMESH_MeshEditor::PGroupIDs groupIds =
|
||||
anEditor.Scale (elements, aPnt, aScaleFact, theCopy,
|
||||
theMakeGroups, theTargetMesh);
|
||||
|
||||
if(theCopy)
|
||||
storeResult(anEditor);
|
||||
|
||||
return theMakeGroups ? getGroups(groupIds.get()) : 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Scale
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMESH_MeshEditor_i::Scale(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::PointStruct& thePoint,
|
||||
const SMESH::double_array& theScaleFact,
|
||||
CORBA::Boolean theCopy)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << this << ".Scale( "
|
||||
<< theObject << ", "
|
||||
<< "SMESH.PointStruct( " << thePoint.x << ", "
|
||||
<< thePoint.y << ", " << thePoint.z << " ) ,"
|
||||
<< theScaleFact << ", "
|
||||
<< theCopy << " )";
|
||||
}
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
scale(anElementsId, thePoint, theScaleFact, theCopy, false);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ScaleMakeGroups
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::ListOfGroups*
|
||||
SMESH_MeshEditor_i::ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::PointStruct& thePoint,
|
||||
const SMESH::double_array& theScaleFact)
|
||||
{
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups * aGroups =
|
||||
scale(anElementsId, thePoint, theScaleFact, true, true);
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".Scale("
|
||||
<< theObject << ","
|
||||
<< "SMESH.PointStruct(" <<thePoint.x << ","
|
||||
<< thePoint.y << "," << thePoint.z << "),"
|
||||
<< theScaleFact << ",True,True)";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ScaleMakeMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::SMESH_Mesh_ptr
|
||||
SMESH_MeshEditor_i::ScaleMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::PointStruct& thePoint,
|
||||
const SMESH::double_array& theScaleFact,
|
||||
CORBA::Boolean theCopyGroups,
|
||||
const char* theMeshName)
|
||||
{
|
||||
SMESH_Mesh_i* mesh_i;
|
||||
SMESH::SMESH_Mesh_var mesh;
|
||||
{ // open new scope to dump "MakeMesh" command
|
||||
// and then "GetGroups" using SMESH_Mesh::GetGroups()
|
||||
|
||||
TPythonDump pydump; // to prevent dump at mesh creation
|
||||
mesh = makeMesh( theMeshName );
|
||||
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
|
||||
|
||||
if ( mesh_i ) {
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
scale(anElementsId, thePoint, theScaleFact,
|
||||
false, theCopyGroups, & mesh_i->GetImpl());
|
||||
mesh_i->CreateGroupServants();
|
||||
}
|
||||
if ( !myPreviewMode ) {
|
||||
pydump << mesh << " = " << this << ".ScaleMakeMesh( "
|
||||
<< theObject << ", "
|
||||
<< "SMESH.PointStruct( " << thePoint.x << ", "
|
||||
<< thePoint.y << ", " << thePoint.z << " ) ,"
|
||||
<< theScaleFact << ", "
|
||||
<< theCopyGroups << ", '"
|
||||
<< theMeshName << "' )";
|
||||
}
|
||||
}
|
||||
|
||||
//dump "GetGroups"
|
||||
if(!myPreviewMode && mesh_i)
|
||||
mesh_i->GetGroups();
|
||||
|
||||
return mesh._retn();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FindCoincidentNodes
|
||||
//purpose :
|
||||
|
@ -426,6 +426,21 @@ public:
|
||||
CORBA::Boolean CopyGroups,
|
||||
const char* MeshName);
|
||||
|
||||
void Scale(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::PointStruct& thePoint,
|
||||
const SMESH::double_array& theScaleFact,
|
||||
CORBA::Boolean theCopy);
|
||||
|
||||
SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::PointStruct& thePoint,
|
||||
const SMESH::double_array& theScaleFact);
|
||||
|
||||
SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
|
||||
const SMESH::PointStruct& Point,
|
||||
const SMESH::double_array& theScaleFact,
|
||||
CORBA::Boolean CopyGroups,
|
||||
const char* MeshName);
|
||||
|
||||
void FindCoincidentNodes (CORBA::Double Tolerance,
|
||||
SMESH::array_of_long_array_out GroupsOfNodes);
|
||||
void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
|
||||
@ -702,6 +717,13 @@ public:
|
||||
const bool MakeGroups,
|
||||
::SMESH_Mesh* TargetMesh=0);
|
||||
|
||||
SMESH::ListOfGroups* scale(const SMESH::long_array & theIDsOfElements,
|
||||
const SMESH::PointStruct& thePoint,
|
||||
const SMESH::double_array& theScaleFact,
|
||||
CORBA::Boolean theCopy,
|
||||
const bool theMakeGroups,
|
||||
::SMESH_Mesh* theTargetMesh=0);
|
||||
|
||||
SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
|
||||
|
||||
void DumpGroupsList(SMESH::TPythonDump & theDumpPython,
|
||||
|
@ -3271,6 +3271,51 @@ class Mesh:
|
||||
mesh.SetParameters(Parameters)
|
||||
return Mesh( self.smeshpyD, self.geompyD, mesh )
|
||||
|
||||
|
||||
|
||||
## Scales the object
|
||||
# @param theObject - the object to translate (mesh, submesh, or group)
|
||||
# @param thePoint - base point for scale
|
||||
# @param theScaleFact - scale factors for axises
|
||||
# @param Copy - allows copying the translated elements
|
||||
# @param MakeGroups - forces the generation of new groups from existing
|
||||
# ones (if Copy)
|
||||
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True,
|
||||
# empty list otherwise
|
||||
def Scale(self, theObject, thePoint, theScaleFact, Copy, MakeGroups=False):
|
||||
if ( isinstance( theObject, Mesh )):
|
||||
theObject = theObject.GetMesh()
|
||||
if ( isinstance( theObject, list )):
|
||||
theObject = self.editor.MakeIDSource(theObject)
|
||||
|
||||
thePoint, Parameters = ParsePointStruct(thePoint)
|
||||
self.mesh.SetParameters(Parameters)
|
||||
|
||||
if Copy and MakeGroups:
|
||||
return self.editor.ScaleMakeGroups(theObject, thePoint, theScaleFact)
|
||||
self.editor.Scale(theObject, thePoint, theScaleFact, Copy)
|
||||
return []
|
||||
|
||||
## Creates a new mesh from the translated object
|
||||
# @param theObject - the object to translate (mesh, submesh, or group)
|
||||
# @param thePoint - base point for scale
|
||||
# @param theScaleFact - scale factors for axises
|
||||
# @param MakeGroups - forces the generation of new groups from existing ones
|
||||
# @param NewMeshName - the name of the newly created mesh
|
||||
# @return instance of Mesh class
|
||||
def ScaleMakeMesh(self, theObject, thePoint, theScaleFact, MakeGroups=False, NewMeshName=""):
|
||||
if (isinstance(theObject, Mesh)):
|
||||
theObject = theObject.GetMesh()
|
||||
if ( isinstance( theObject, list )):
|
||||
theObject = self.editor.MakeIDSource(theObject)
|
||||
|
||||
mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact,
|
||||
MakeGroups, NewMeshName)
|
||||
#mesh.SetParameters(Parameters)
|
||||
return Mesh( self.smeshpyD, self.geompyD, mesh )
|
||||
|
||||
|
||||
|
||||
## Rotates the elements
|
||||
# @param IDsOfElements list of elements ids
|
||||
# @param Axis the axis of rotation (AxisStruct or geom line)
|
||||
|