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);
110 * \brief Bind a node to a vertex
111 * \param NodeID - node ID
112 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
114 void SetNodeOnVertex(in long NodeID, in long VertexID)
115 raises (SALOME::SALOME_Exception);
117 * \brief Store node position on an edge
118 * \param NodeID - node ID
119 * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
120 * \param paramOnEdge - parameter on edge where the node is located
122 void SetNodeOnEdge(in long NodeID, in long EdgeID, in double paramOnEdge)
123 raises (SALOME::SALOME_Exception);
125 * \brief Store node position on a face
126 * \param NodeID - node ID
127 * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
128 * \param u - U parameter on face where the node is located
129 * \param v - V parameter on face where the node is located
131 void SetNodeOnFace(in long NodeID, in long FaceID, in double u, in double v)
132 raises (SALOME::SALOME_Exception);
134 * \brief Bind a node to a solid
135 * \param NodeID - node ID
136 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
138 void SetNodeInVolume(in long NodeID, in long SolidID)
139 raises (SALOME::SALOME_Exception);
141 * \brief Bind an element to a shape
142 * \param ElementID - element ID
143 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
145 void SetMeshElementOnShape(in long ElementID, in long ShapeID)
146 raises (SALOME::SALOME_Exception);
149 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
151 boolean InverseDiag(in long NodeID1, in long NodeID2);
153 boolean DeleteDiag(in long NodeID1, in long NodeID2);
155 boolean Reorient(in long_array IDsOfElements);
157 boolean ReorientObject(in SMESH_IDSource theObject);
160 * \brief Fuse neighbour triangles into quadrangles.
161 * \param theElems The triangles to be fused.
162 * \param theCriterion Is used to choose a neighbour to fuse with.
163 * \param theMaxAngle Is a max angle between element normals at which fusion
164 * is still performed; theMaxAngle is mesured in radians.
165 * \return TRUE in case of success, FALSE otherwise.
167 boolean TriToQuad (in long_array IDsOfElements,
168 in NumericalFunctor Criterion,
172 * \brief Fuse neighbour triangles into quadrangles.
174 * Behaves like the above method, taking list of elements from \a theObject
176 boolean TriToQuadObject (in SMESH_IDSource theObject,
177 in NumericalFunctor Criterion,
181 * \brief Split quadrangles into triangles.
182 * \param theElems The faces to be splitted.
183 * \param theCriterion Is used to choose a diagonal for splitting.
184 * \return TRUE in case of success, FALSE otherwise.
186 boolean QuadToTri (in long_array IDsOfElements,
187 in NumericalFunctor Criterion);
190 * \brief Split quadrangles into triangles.
192 * Behaves like the above method, taking list of elements from \a theObject
194 boolean QuadToTriObject (in SMESH_IDSource theObject,
195 in NumericalFunctor Criterion);
198 * \brief Split quadrangles into triangles.
199 * \param theElems The faces to be splitted.
200 * \param the13Diag Is used to choose a diagonal for splitting.
201 * \return TRUE in case of success, FALSE otherwise.
203 boolean SplitQuad (in long_array IDsOfElements,
207 * \brief Split quadrangles into triangles.
209 * Behaves like the above method, taking list of elements from \a theObject
211 boolean SplitQuadObject (in SMESH_IDSource theObject,
215 * Find better splitting of the given quadrangle.
216 * \param IDOfQuad ID of the quadrangle to be splitted.
217 * \param Criterion A criterion to choose a diagonal for splitting.
218 * \return 1 if 1-3 diagonal is better, 2 if 2-4
219 * diagonal is better, 0 if error occurs.
221 long BestSplit (in long IDOfQuad,
222 in NumericalFunctor Criterion);
224 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
226 boolean Smooth(in long_array IDsOfElements,
227 in long_array IDsOfFixedNodes,
228 in long MaxNbOfIterations,
229 in double MaxAspectRatio,
230 in Smooth_Method Method);
232 boolean SmoothObject(in SMESH_IDSource theObject,
233 in long_array IDsOfFixedNodes,
234 in long MaxNbOfIterations,
235 in double MaxAspectRatio,
236 in Smooth_Method Method);
238 boolean SmoothParametric(in long_array IDsOfElements,
239 in long_array IDsOfFixedNodes,
240 in long MaxNbOfIterations,
241 in double MaxAspectRatio,
242 in Smooth_Method Method);
244 boolean SmoothParametricObject(in SMESH_IDSource theObject,
245 in long_array IDsOfFixedNodes,
246 in long MaxNbOfIterations,
247 in double MaxAspectRatio,
248 in Smooth_Method Method);
250 void ConvertToQuadratic(in boolean theForce3d);
252 boolean ConvertFromQuadratic();
254 void RenumberNodes();
256 void RenumberElements();
259 * \brief Genarate dim+1 elements by rotation of given elements around axis
260 * \param IDsOfElements - elements to ratate
261 * \param Axix - rotation axis
262 * \param AngleInRadians - rotation angle
263 * \param NbOfSteps - number of elements to generate from one element
265 void RotationSweep(in long_array IDsOfElements,
267 in double AngleInRadians,
269 in double Tolerance);
271 * \brief Same as previous but additionally create groups of elements
272 * generated from elements belonging to preexisting groups
274 ListOfGroups RotationSweepMakeGroups(in long_array IDsOfElements,
276 in double AngleInRadians,
278 in double Tolerance);
280 * \brief Genarate dim+1 elements by rotation of the object around axis
281 * \param theObject - object containing elements to ratate
282 * \param Axix - rotation axis
283 * \param AngleInRadians - rotation angle
284 * \param NbOfSteps - number of elements to generate from one element
286 void RotationSweepObject(in SMESH_IDSource theObject,
288 in double AngleInRadians,
290 in double Tolerance);
292 * \brief Same as previous but additionally create groups of elements
293 * generated from elements belonging to preexisting groups
295 ListOfGroups RotationSweepObjectMakeGroups(in SMESH_IDSource theObject,
297 in double AngleInRadians,
299 in double Tolerance);
301 * \brief Genarate dim+1 elements by extrusion of elements along vector
302 * \param IDsOfElements - elements to sweep
303 * \param StepVector - vector giving direction and distance of an extrusion step
304 * \param NbOfSteps - number of elements to generate from one element
306 void ExtrusionSweep(in long_array IDsOfElements,
307 in DirStruct StepVector,
310 * \brief Same as previous but additionally create groups of elements
311 * generated from elements belonging to preexisting groups
313 ListOfGroups ExtrusionSweepMakeGroups(in long_array IDsOfElements,
314 in DirStruct StepVector,
317 * Generate new elements by extrusion of theElements
318 * by StepVector by NbOfSteps
319 * param ExtrFlags set flags for performing extrusion
320 * param SewTolerance - uses for comparing locations of nodes if flag
321 * EXTRUSION_FLAG_SEW is set
323 void AdvancedExtrusion(in long_array IDsOfElements,
324 in DirStruct StepVector,
327 in double SewTolerance);
329 * \brief Same as previous but additionally create groups of elements
330 * generated from elements belonging to preexisting groups
332 ListOfGroups AdvancedExtrusionMakeGroups(in long_array IDsOfElements,
333 in DirStruct StepVector,
336 in double SewTolerance);
338 void ExtrusionSweepObject(in SMESH_IDSource theObject,
339 in DirStruct StepVector,
341 ListOfGroups ExtrusionSweepObjectMakeGroups(in SMESH_IDSource theObject,
342 in DirStruct StepVector,
345 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
346 in DirStruct StepVector,
348 ListOfGroups ExtrusionSweepObject1DMakeGroups(in SMESH_IDSource theObject,
349 in DirStruct StepVector,
352 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
353 in DirStruct StepVector,
355 ListOfGroups ExtrusionSweepObject2DMakeGroups(in SMESH_IDSource theObject,
356 in DirStruct StepVector,
359 enum Extrusion_Error {
364 EXTR_BAD_STARTING_NODE,
365 EXTR_BAD_ANGLES_NUMBER,
366 EXTR_CANT_GET_TANGENT
369 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
370 in SMESH_Mesh PathMesh,
371 in GEOM::GEOM_Object PathShape,
373 in boolean HasAngles,
374 in double_array Angles,
375 in boolean HasRefPoint,
376 in PointStruct RefPoint);
377 ListOfGroups ExtrusionAlongPathMakeGroups(in long_array IDsOfElements,
378 in SMESH_Mesh PathMesh,
379 in GEOM::GEOM_Object PathShape,
381 in boolean HasAngles,
382 in double_array Angles,
383 in boolean HasRefPoint,
384 in PointStruct RefPoint,
385 out Extrusion_Error Error);
387 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
388 in SMESH_Mesh PathMesh,
389 in GEOM::GEOM_Object PathShape,
391 in boolean HasAngles,
392 in double_array Angles,
393 in boolean HasRefPoint,
394 in PointStruct RefPoint);
395 ListOfGroups ExtrusionAlongPathObjectMakeGroups(in SMESH_IDSource theObject,
396 in SMESH_Mesh PathMesh,
397 in GEOM::GEOM_Object PathShape,
399 in boolean HasAngles,
400 in double_array Angles,
401 in boolean HasRefPoint,
402 in PointStruct RefPoint,
403 out Extrusion_Error Error);
406 * Compute rotation angles for ExtrusionAlongPath as linear variation
407 * of given angles along path steps
408 * param PathMesh mesh containing a 1D sub-mesh on the edge, along
409 * which proceeds the extrusion
410 * param PathShape is shape(edge); as the mesh can be complex, the edge
411 * is used to define the sub-mesh for the path
413 double_array LinearAnglesVariation(in SMESH_Mesh PathMesh,
414 in GEOM::GEOM_Object PathShape,
415 in double_array Angles);
417 enum MirrorType { POINT, AXIS, PLANE };
419 void Mirror (in long_array IDsOfElements,
420 in AxisStruct Mirror,
421 in MirrorType theMirrorType,
423 ListOfGroups MirrorMakeGroups (in long_array IDsOfElements,
424 in AxisStruct Mirror,
425 in MirrorType theMirrorType);
427 void MirrorObject (in SMESH_IDSource theObject,
428 in AxisStruct Mirror,
429 in MirrorType theMirrorType,
431 ListOfGroups MirrorObjectMakeGroups (in SMESH_IDSource theObject,
432 in AxisStruct Mirror,
433 in MirrorType theMirrorType);
435 void Translate (in long_array IDsOfElements,
438 ListOfGroups TranslateMakeGroups (in long_array IDsOfElements,
439 in DirStruct Vector);
441 void TranslateObject (in SMESH_IDSource theObject,
444 ListOfGroups TranslateObjectMakeGroups (in SMESH_IDSource theObject,
445 in DirStruct Vector);
447 void Rotate (in long_array IDsOfElements,
449 in double AngleInRadians,
451 ListOfGroups RotateMakeGroups (in long_array IDsOfElements,
453 in double AngleInRadians);
455 void RotateObject (in SMESH_IDSource theObject,
457 in double AngleInRadians,
459 ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
461 in double AngleInRadians);
463 void FindCoincidentNodes (in double Tolerance,
464 out array_of_long_array GroupsOfNodes);
466 void FindCoincidentNodesOnPart (in SMESH_IDSource SubMeshOrGroup,
468 out array_of_long_array GroupsOfNodes);
470 void MergeNodes (in array_of_long_array GroupsOfNodes);
473 * \brief Find elements built on the same nodes.
474 * \param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching.
475 * \return List of groups of equal elements.
477 void FindEqualElements (in SMESH_IDSource MeshOrSubMeshOrGroup,
478 out array_of_long_array GroupsOfElementsID);
481 * \brief Merge elements in each given group.
482 * \param GroupsOfElementsID Groups of elements for merging.
484 void MergeElements(in array_of_long_array GroupsOfElementsID);
487 * \brief Merge equal elements in the whole mesh.
489 void MergeEqualElements();
492 * If the given ID is a valid node ID (nodeID > 0), just move this node, else
493 * move the node closest to the point to point's location and return ID of the node
495 long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
499 SEW_BORDER1_NOT_FOUND,
500 SEW_BORDER2_NOT_FOUND,
501 SEW_BOTH_BORDERS_NOT_FOUND,
503 SEW_VOLUMES_TO_SPLIT,
504 // for SewSideElements() only:
505 SEW_DIFF_NB_OF_ELEMENTS,
506 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
511 Sew_Error SewFreeBorders (in long FirstNodeID1,
512 in long SecondNodeID1,
514 in long FirstNodeID2,
515 in long SecondNodeID2,
517 in boolean CreatePolygons,
518 in boolean CreatePolyedrs);
520 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
521 in long SecondNodeID1,
523 in long FirstNodeID2,
524 in long SecondNodeID2);
526 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
527 in long SecondNodeIDOnFreeBorder,
528 in long LastNodeIDOnFreeBorder,
529 in long FirstNodeIDOnSide,
530 in long LastNodeIDOnSide,
531 in boolean CreatePolygons,
532 in boolean CreatePolyedrs);
534 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
535 in long_array IDsOfSide2Elements,
536 in long NodeID1OfSide1ToMerge,
537 in long NodeID1OfSide2ToMerge,
538 in long NodeID2OfSide1ToMerge,
539 in long NodeID2OfSide2ToMerge);
542 * Set new nodes for given element.
543 * If number of nodes is not corresponded to type of
544 * element - returns false
546 boolean ChangeElemNodes(in long ide, in long_array newIDs);
549 * Return data of mesh edition preview which is computed provided
550 * that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
552 MeshPreviewStruct GetPreviewData();
555 * If during last operation of MeshEditor some nodes were
556 * created this method returns list of it's IDs, if new nodes
557 * not creared - returns empty list
559 long_array GetLastCreatedNodes();
562 * If during last operation of MeshEditor some elements were
563 * created this method returns list of it's IDs, if new elements
564 * not creared - returns empty list
566 long_array GetLastCreatedElems();