Thrusectioning surfaces that are sharing a boundary? (Python)
Hi there! I'm currently learning Gmsh to be able to automatically create a geometry of artery plaque and correspondingly mesh it for finite element analysis.
The input data we have is the 2D boundaries of all the different components at different slices of the artery, the approach I am taking now is to construct 2D splines for each component, do a Thrusection for all the plaque components that span multiple slices and then do boolean operators to make sure that there are no intersecting volumes.
The main problem I am having now is that often the components share boundary points at some slices (ie: they are touching in slice 0) while in the later slice they diverge. In terms of Thrusectioning I am having trouble creating a generalizable/automatable way of dealing with this considering the following points:
- If I thrusection multiple curves they must all have the same number of splines
- The starting point for each spline must be parallel to each other otherwise the surfaces seem to cross?
- I do not need the components to conform exactly to the boundary nodes, as long as the component surfaces are cohering properly!
- The same component can interface with multiple surfaces at different slices, for example component A can share multiple border points on its left side with component B at slice 0, but in slice 2 it can share multiple border points on it's right side with component C.
Given these restrictions I thought of the following options A) If two adjacent components (A and B) are touching in slice 0 and share boundary points I can either declare a spline for each component -The problem: The splines for A and B start intersecting multiple times at the interface and create "gaps" in the combined surface. -Possible solution: I copy the interface nodes between A and B, shift them inside A (for example) and then I create a single spline for A using the original interface nodes and a single spline for B using the shifted interface nodes, this would make it less likely that the splines intersect multiple times, I can then thrusection these 2 splines into the next slice and then do a boolean cut to make B "eat" into A to prevent intersections. The only problem is that I feel it's complicated to automate and generalize and I would prefer there be simpler solution.
B) I split up the component spline into multiple splines depending on how many interfaces it touches over the multiple slices -The problem: I'm not sure if this would work in a complicated geometry as I have in the upwards of 100 components that are all intersecting to keep track of! Furthermore I would need to think of a way to "orient" the order of the splines such that the thrusection doesn't bug out
C) I create "interface splines" and non interface splines and somehow merge them together into 1 spline using boolean operatores -The problem: I don't think this is possible! I tried using the fuse command with the splines but it did not work.
Here's an example problem that shows what I mean
I attached the sample code that reproduces a simple scenario that I would have to deal with when constructing the geometry, it consists of 2 components (1 and 2) stuck together at slice 0, while in slice 1 they split apart into separate curves. I also included commented code for full splining of each component (a single spline that goes through the interface points).
I know I can fix it by doing option A or B as specified but I am thinking of how to scale it up with multiple components
I would very much appreciate your expert experience and support in tackling this issue! Thank you very much Karim,