Showing results for 
Search instead for 
Did you mean: 

Cut 2D Mesh by Curve(s)




Here is my API for splitting a 2D mesh with a/several curve(s).

This is a tricky functionnality, and the macro is definitely NOT full proof.


Example: the user wants to cut the green mesh with the red curves, i.e. "imprint" the curves onto the mesh. No other geometry is present in the model (meaning that the mesh does not need to be associated to surfaces/solids).

The dotted line is the recommended element selection: the smaller and close to the curves it is, the faster the macro will go because it won't have to check that many edges for intersection.


Mesh Split.jpg


From fig 1 to 2 is the nominal execution, the curves are properly "imprinted" on the mesh. The default tolerance is used (min edge / 3), with a higher tolerance there would be less small elements.


Fig3 shows a classic "bug" that the user needs to keep in mind: the API method which computes intersections sees lines as infinite. Therefore if the user extends the element selection, more elements will be cut even "after" the ends of the line. Therefore the elements should be chosen carefully!


Note that free edges appear if the curve does not go from node to node. A free edge check should always follow this macro.

Finally the macro is not thought out for the case where the curve is not very close to the mesh: starnge things can happen in this case.


There is room for improvement, but if it can help...