1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESH_MeshEditor.idl
25 #ifndef _SMESH_MESHEDITOR_IDL_
26 #define _SMESH_MESHEDITOR_IDL_
28 #include "SMESH_Mesh.idl"
33 * Structure used in mesh edit preview data
35 struct ElementSubType { ElementType SMDS_ElementType;
37 long nbNodesInElement; };
39 typedef sequence<ElementSubType> types_array;
42 * Structure containing mesh edit preview data
44 struct MeshPreviewStruct { nodes_array nodesXYZ;
45 long_array elementConnectivities;
46 types_array elementTypes; };
49 * This interface makes modifications on the Mesh - removing elements and nodes etc.
51 interface NumericalFunctor;
52 interface SMESH_MeshEditor
54 boolean RemoveElements(in long_array IDsOfElements);
56 boolean RemoveNodes(in long_array IDsOfNodes);
58 long AddNode(in double x, in double y, in double z);
61 * Create edge, either linear and quadratic (this is determed
62 * by number of given nodes).
63 * \param IdsOfNodes List of node IDs for creation of element.
64 * Needed order of nodes in this list corresponds to description
65 * of MED. This description is located by the following link:
66 * http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
68 long AddEdge(in long_array IDsOfNodes);
71 * Create face, either linear and quadratic (this is determed
72 * by number of given nodes).
73 * \param IdsOfNodes List of node IDs for creation of element.
74 * Needed order of nodes in this list corresponds to description
75 * of MED. This description is located by the following link:
76 * http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
78 long AddFace(in long_array IDsOfNodes);
80 long AddPolygonalFace(in long_array IdsOfNodes);
83 * Create volume, either linear and quadratic (this is determed
84 * by number of given nodes).
85 * \param IdsOfNodes List of node IDs for creation of element.
86 * Needed order of nodes in this list corresponds to description
87 * of MED. This description is located by the following link:
88 * http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
90 long AddVolume(in long_array IDsOfNodes);
93 * Create volume of many faces, giving nodes for each face.
94 * \param IdsOfNodes List of node IDs for volume creation face by face.
95 * \param Quantities List of integer values, Quantities[i]
96 * gives quantity of nodes in face number i.
98 long AddPolyhedralVolume (in long_array IdsOfNodes,
99 in long_array Quantities);
102 * Create volume of many faces, giving IDs of existing faces.
103 * \param IdsOfFaces List of face IDs for volume creation.
104 * \note The created volume will refer only to nodes
105 * of the given faces, not to the faces itself.
107 long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
109 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
111 boolean InverseDiag(in long NodeID1, in long NodeID2);
113 boolean DeleteDiag(in long NodeID1, in long NodeID2);
115 boolean Reorient(in long_array IDsOfElements);
117 boolean ReorientObject(in SMESH_IDSource theObject);
120 * \brief Fuse neighbour triangles into quadrangles.
121 * \param theElems The triangles to be fused.
122 * \param theCriterion Is used to choose a neighbour to fuse with.
123 * \param theMaxAngle Is a max angle between element normals at which fusion
124 * is still performed; theMaxAngle is mesured in radians.
125 * \return TRUE in case of success, FALSE otherwise.
127 boolean TriToQuad (in long_array IDsOfElements,
128 in NumericalFunctor Criterion,
132 * \brief Fuse neighbour triangles into quadrangles.
134 * Behaves like the above method, taking list of elements from \a theObject
136 boolean TriToQuadObject (in SMESH_IDSource theObject,
137 in NumericalFunctor Criterion,
141 * \brief Split quadrangles into triangles.
142 * \param theElems The faces to be splitted.
143 * \param theCriterion Is used to choose a diagonal for splitting.
144 * \return TRUE in case of success, FALSE otherwise.
146 boolean QuadToTri (in long_array IDsOfElements,
147 in NumericalFunctor Criterion);
150 * \brief Split quadrangles into triangles.
152 * Behaves like the above method, taking list of elements from \a theObject
154 boolean QuadToTriObject (in SMESH_IDSource theObject,
155 in NumericalFunctor Criterion);
158 * \brief Split quadrangles into triangles.
159 * \param theElems The faces to be splitted.
160 * \param the13Diag Is used to choose a diagonal for splitting.
161 * \return TRUE in case of success, FALSE otherwise.
163 boolean SplitQuad (in long_array IDsOfElements,
167 * \brief Split quadrangles into triangles.
169 * Behaves like the above method, taking list of elements from \a theObject
171 boolean SplitQuadObject (in SMESH_IDSource theObject,
175 * Find better splitting of the given quadrangle.
176 * \param IDOfQuad ID of the quadrangle to be splitted.
177 * \param Criterion A criterion to choose a diagonal for splitting.
178 * \return 1 if 1-3 diagonal is better, 2 if 2-4
179 * diagonal is better, 0 if error occurs.
181 long BestSplit (in long IDOfQuad,
182 in NumericalFunctor Criterion);
184 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
186 boolean Smooth(in long_array IDsOfElements,
187 in long_array IDsOfFixedNodes,
188 in long MaxNbOfIterations,
189 in double MaxAspectRatio,
190 in Smooth_Method Method);
192 boolean SmoothObject(in SMESH_IDSource theObject,
193 in long_array IDsOfFixedNodes,
194 in long MaxNbOfIterations,
195 in double MaxAspectRatio,
196 in Smooth_Method Method);
198 boolean SmoothParametric(in long_array IDsOfElements,
199 in long_array IDsOfFixedNodes,
200 in long MaxNbOfIterations,
201 in double MaxAspectRatio,
202 in Smooth_Method Method);
204 boolean SmoothParametricObject(in SMESH_IDSource theObject,
205 in long_array IDsOfFixedNodes,
206 in long MaxNbOfIterations,
207 in double MaxAspectRatio,
208 in Smooth_Method Method);
210 void ConvertToQuadratic(in boolean theForce3d);
212 boolean ConvertFromQuadratic();
214 void RenumberNodes();
216 void RenumberElements();
219 * \brief Genarate dim+1 elements by rotation of given elements around axis
220 * \param IDsOfElements - elements to ratate
221 * \param Axix - rotation axis
222 * \param AngleInRadians - rotation angle
223 * \param NbOfSteps - number of elements to generate from one element
225 void RotationSweep(in long_array IDsOfElements,
227 in double AngleInRadians,
229 in double Tolerance);
231 * \brief Same as previous but additionally create groups of elements
232 * generated from elements belonging to preexisting groups
234 ListOfGroups RotationSweepMakeGroups(in long_array IDsOfElements,
236 in double AngleInRadians,
238 in double Tolerance);
240 * \brief Genarate dim+1 elements by rotation of the object around axis
241 * \param theObject - object containing elements to ratate
242 * \param Axix - rotation axis
243 * \param AngleInRadians - rotation angle
244 * \param NbOfSteps - number of elements to generate from one element
246 void RotationSweepObject(in SMESH_IDSource theObject,
248 in double AngleInRadians,
250 in double Tolerance);
252 * \brief Same as previous but additionally create groups of elements
253 * generated from elements belonging to preexisting groups
255 ListOfGroups RotationSweepObjectMakeGroups(in SMESH_IDSource theObject,
257 in double AngleInRadians,
259 in double Tolerance);
261 * \brief Genarate dim+1 elements by extrusion of elements along vector
262 * \param IDsOfElements - elements to sweep
263 * \param StepVector - vector giving direction and distance of an extrusion step
264 * \param NbOfSteps - number of elements to generate from one element
266 void ExtrusionSweep(in long_array IDsOfElements,
267 in DirStruct StepVector,
270 * \brief Same as previous but additionally create groups of elements
271 * generated from elements belonging to preexisting groups
273 ListOfGroups ExtrusionSweepMakeGroups(in long_array IDsOfElements,
274 in DirStruct StepVector,
277 * Generate new elements by extrusion of theElements
278 * by StepVector by NbOfSteps
279 * param ExtrFlags set flags for performing extrusion
280 * param SewTolerance - uses for comparing locations of nodes if flag
281 * EXTRUSION_FLAG_SEW is set
283 void AdvancedExtrusion(in long_array IDsOfElements,
284 in DirStruct StepVector,
287 in double SewTolerance);
289 * \brief Same as previous but additionally create groups of elements
290 * generated from elements belonging to preexisting groups
292 ListOfGroups AdvancedExtrusionMakeGroups(in long_array IDsOfElements,
293 in DirStruct StepVector,
296 in double SewTolerance);
298 void ExtrusionSweepObject(in SMESH_IDSource theObject,
299 in DirStruct StepVector,
301 ListOfGroups ExtrusionSweepObjectMakeGroups(in SMESH_IDSource theObject,
302 in DirStruct StepVector,
305 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
306 in DirStruct StepVector,
308 ListOfGroups ExtrusionSweepObject1DMakeGroups(in SMESH_IDSource theObject,
309 in DirStruct StepVector,
312 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
313 in DirStruct StepVector,
315 ListOfGroups ExtrusionSweepObject2DMakeGroups(in SMESH_IDSource theObject,
316 in DirStruct StepVector,
319 enum Extrusion_Error {
324 EXTR_BAD_STARTING_NODE,
325 EXTR_BAD_ANGLES_NUMBER,
326 EXTR_CANT_GET_TANGENT
329 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
330 in SMESH_Mesh PathMesh,
331 in GEOM::GEOM_Object PathShape,
333 in boolean HasAngles,
334 in double_array Angles,
335 in boolean HasRefPoint,
336 in PointStruct RefPoint);
337 ListOfGroups ExtrusionAlongPathMakeGroups(in long_array IDsOfElements,
338 in SMESH_Mesh PathMesh,
339 in GEOM::GEOM_Object PathShape,
341 in boolean HasAngles,
342 in double_array Angles,
343 in boolean HasRefPoint,
344 in PointStruct RefPoint,
345 out Extrusion_Error Error);
347 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
348 in SMESH_Mesh PathMesh,
349 in GEOM::GEOM_Object PathShape,
351 in boolean HasAngles,
352 in double_array Angles,
353 in boolean HasRefPoint,
354 in PointStruct RefPoint);
355 ListOfGroups ExtrusionAlongPathObjectMakeGroups(in SMESH_IDSource theObject,
356 in SMESH_Mesh PathMesh,
357 in GEOM::GEOM_Object PathShape,
359 in boolean HasAngles,
360 in double_array Angles,
361 in boolean HasRefPoint,
362 in PointStruct RefPoint,
363 out Extrusion_Error Error);
366 * Compute rotation angles for ExtrusionAlongPath as linear variation
367 * of given angles along path steps
368 * param PathMesh mesh containing a 1D sub-mesh on the edge, along
369 * which proceeds the extrusion
370 * param PathShape is shape(edge); as the mesh can be complex, the edge
371 * is used to define the sub-mesh for the path
373 double_array LinearAnglesVariation(in SMESH_Mesh PathMesh,
374 in GEOM::GEOM_Object PathShape,
375 in double_array Angles);
377 enum MirrorType { POINT, AXIS, PLANE };
379 void Mirror (in long_array IDsOfElements,
380 in AxisStruct Mirror,
381 in MirrorType theMirrorType,
383 ListOfGroups MirrorMakeGroups (in long_array IDsOfElements,
384 in AxisStruct Mirror,
385 in MirrorType theMirrorType);
387 void MirrorObject (in SMESH_IDSource theObject,
388 in AxisStruct Mirror,
389 in MirrorType theMirrorType,
391 ListOfGroups MirrorObjectMakeGroups (in SMESH_IDSource theObject,
392 in AxisStruct Mirror,
393 in MirrorType theMirrorType);
395 void Translate (in long_array IDsOfElements,
398 ListOfGroups TranslateMakeGroups (in long_array IDsOfElements,
399 in DirStruct Vector);
401 void TranslateObject (in SMESH_IDSource theObject,
404 ListOfGroups TranslateObjectMakeGroups (in SMESH_IDSource theObject,
405 in DirStruct Vector);
407 void Rotate (in long_array IDsOfElements,
409 in double AngleInRadians,
411 ListOfGroups RotateMakeGroups (in long_array IDsOfElements,
413 in double AngleInRadians);
415 void RotateObject (in SMESH_IDSource theObject,
417 in double AngleInRadians,
419 ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
421 in double AngleInRadians);
423 void FindCoincidentNodes (in double Tolerance,
424 out array_of_long_array GroupsOfNodes);
426 void FindCoincidentNodesOnPart (in SMESH_IDSource SubMeshOrGroup,
428 out array_of_long_array GroupsOfNodes);
430 void MergeNodes (in array_of_long_array GroupsOfNodes);
433 * \brief Find elements built on the same nodes.
434 * \param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching.
435 * \return List of groups of equal elements.
437 void FindEqualElements (in SMESH_IDSource MeshOrSubMeshOrGroup,
438 out array_of_long_array GroupsOfElementsID);
441 * \brief Merge elements in each given group.
442 * \param GroupsOfElementsID Groups of elements for merging.
444 void MergeElements(in array_of_long_array GroupsOfElementsID);
447 * \brief Merge equal elements in the whole mesh.
449 void MergeEqualElements();
452 * If the given ID is a valid node ID (nodeID > 0), just move this node, else
453 * move the node closest to the point to point's location and return ID of the node
455 long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
459 SEW_BORDER1_NOT_FOUND,
460 SEW_BORDER2_NOT_FOUND,
461 SEW_BOTH_BORDERS_NOT_FOUND,
463 SEW_VOLUMES_TO_SPLIT,
464 // for SewSideElements() only:
465 SEW_DIFF_NB_OF_ELEMENTS,
466 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
471 Sew_Error SewFreeBorders (in long FirstNodeID1,
472 in long SecondNodeID1,
474 in long FirstNodeID2,
475 in long SecondNodeID2,
477 in boolean CreatePolygons,
478 in boolean CreatePolyedrs);
480 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
481 in long SecondNodeID1,
483 in long FirstNodeID2,
484 in long SecondNodeID2);
486 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
487 in long SecondNodeIDOnFreeBorder,
488 in long LastNodeIDOnFreeBorder,
489 in long FirstNodeIDOnSide,
490 in long LastNodeIDOnSide,
491 in boolean CreatePolygons,
492 in boolean CreatePolyedrs);
494 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
495 in long_array IDsOfSide2Elements,
496 in long NodeID1OfSide1ToMerge,
497 in long NodeID1OfSide2ToMerge,
498 in long NodeID2OfSide1ToMerge,
499 in long NodeID2OfSide2ToMerge);
502 * Set new nodes for given element.
503 * If number of nodes is not corresponded to type of
504 * element - returns false
506 boolean ChangeElemNodes(in long ide, in long_array newIDs);
509 * Return data of mesh edition preview which is computed provided
510 * that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
512 MeshPreviewStruct GetPreviewData();
515 * If during last operation of MeshEditor some nodes were
516 * created this method returns list of it's IDs, if new nodes
517 * not creared - returns empty list
519 long_array GetLastCreatedNodes();
522 * If during last operation of MeshEditor some elements were
523 * created this method returns list of it's IDs, if new elements
524 * not creared - returns empty list
526 long_array GetLastCreatedElems();