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();
218 void RotationSweep(in long_array IDsOfElements,
220 in double AngleInRadians,
222 in double Tolerance);
224 void RotationSweepObject(in SMESH_IDSource theObject,
226 in double AngleInRadians,
228 in double Tolerance);
230 void ExtrusionSweep(in long_array IDsOfElements,
231 in DirStruct StepVector,
235 * Generate new elements by extrusion of theElements
236 * by StepVector by NbOfSteps
237 * param ExtrFlags set flags for performing extrusion
238 * param SewTolerance - uses for comparing locations of nodes if flag
239 * EXTRUSION_FLAG_SEW is set
241 void AdvancedExtrusion(in long_array IDsOfElements,
242 in DirStruct StepVector,
245 in double SewTolerance);
247 void ExtrusionSweepObject(in SMESH_IDSource theObject,
248 in DirStruct StepVector,
251 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
252 in DirStruct StepVector,
255 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
256 in DirStruct StepVector,
259 enum Extrusion_Error {
264 EXTR_BAD_STARTING_NODE,
265 EXTR_BAD_ANGLES_NUMBER,
266 EXTR_CANT_GET_TANGENT
269 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
270 in SMESH_Mesh PathMesh,
271 in GEOM::GEOM_Object PathShape,
273 in boolean HasAngles,
274 in double_array Angles,
275 in boolean HasRefPoint,
276 in PointStruct RefPoint);
278 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
279 in SMESH_Mesh PathMesh,
280 in GEOM::GEOM_Object PathShape,
282 in boolean HasAngles,
283 in double_array Angles,
284 in boolean HasRefPoint,
285 in PointStruct RefPoint);
288 * Compute rotation angles for ExtrusionAlongPath as linear variation
289 * of given angles along path steps
290 * param PathMesh mesh containing a 1D sub-mesh on the edge, along
291 * which proceeds the extrusion
292 * param PathShape is shape(edge); as the mesh can be complex, the edge
293 * is used to define the sub-mesh for the path
295 double_array LinearAnglesVariation(in SMESH_Mesh PathMesh,
296 in GEOM::GEOM_Object PathShape,
297 in double_array Angles);
299 enum MirrorType { POINT, AXIS, PLANE };
301 void Mirror (in long_array IDsOfElements,
302 in AxisStruct Mirror,
303 in MirrorType theMirrorType,
306 void MirrorObject (in SMESH_IDSource theObject,
307 in AxisStruct Mirror,
308 in MirrorType theMirrorType,
311 void Translate (in long_array IDsOfElements,
315 void TranslateObject (in SMESH_IDSource theObject,
319 void Rotate (in long_array IDsOfElements,
321 in double AngleInRadians,
324 void RotateObject (in SMESH_IDSource theObject,
326 in double AngleInRadians,
329 void FindCoincidentNodes (in double Tolerance,
330 out array_of_long_array GroupsOfNodes);
332 void FindCoincidentNodesOnPart (in SMESH_IDSource SubMeshOrGroup,
334 out array_of_long_array GroupsOfNodes);
336 void MergeNodes (in array_of_long_array GroupsOfNodes);
339 * \brief Find elements built on the same nodes.
340 * \param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching.
341 * \return List of groups of equal elements.
343 void FindEqualElements (in SMESH_IDSource MeshOrSubMeshOrGroup,
344 out array_of_long_array GroupsOfElementsID);
347 * \brief Merge elements in each given group.
348 * \param GroupsOfElementsID Groups of elements for merging.
350 void MergeElements(in array_of_long_array GroupsOfElementsID);
353 * \brief Merge equal elements in the whole mesh.
355 void MergeEqualElements();
358 * If the given ID is a valid node ID (nodeID > 0), just move this node, else
359 * move the node closest to the point to point's location and return ID of the node
361 long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
365 SEW_BORDER1_NOT_FOUND,
366 SEW_BORDER2_NOT_FOUND,
367 SEW_BOTH_BORDERS_NOT_FOUND,
369 SEW_VOLUMES_TO_SPLIT,
370 // for SewSideElements() only:
371 SEW_DIFF_NB_OF_ELEMENTS,
372 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
377 Sew_Error SewFreeBorders (in long FirstNodeID1,
378 in long SecondNodeID1,
380 in long FirstNodeID2,
381 in long SecondNodeID2,
383 in boolean CreatePolygons,
384 in boolean CreatePolyedrs);
386 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
387 in long SecondNodeID1,
389 in long FirstNodeID2,
390 in long SecondNodeID2);
392 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
393 in long SecondNodeIDOnFreeBorder,
394 in long LastNodeIDOnFreeBorder,
395 in long FirstNodeIDOnSide,
396 in long LastNodeIDOnSide,
397 in boolean CreatePolygons,
398 in boolean CreatePolyedrs);
400 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
401 in long_array IDsOfSide2Elements,
402 in long NodeID1OfSide1ToMerge,
403 in long NodeID1OfSide2ToMerge,
404 in long NodeID2OfSide1ToMerge,
405 in long NodeID2OfSide2ToMerge);
408 * Set new nodes for given element.
409 * If number of nodes is not corresponded to type of
410 * element - returns false
412 boolean ChangeElemNodes(in long ide, in long_array newIDs);
415 * Return data of mesh edition preview which is computed provided
416 * that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
418 MeshPreviewStruct GetPreviewData();
421 * If during last operation of MeshEditor some nodes were
422 * created this method returns list of it's IDs, if new nodes
423 * not creared - returns empty list
425 long_array GetLastCreatedNodes();
428 * If during last operation of MeshEditor some elements were
429 * created this method returns list of it's IDs, if new elements
430 * not creared - returns empty list
432 long_array GetLastCreatedElems();