febiosoftware / FEBioStudio

https://febio.org/
MIT License
64 stars 21 forks source link

confusion about code on window: Build --> Create; & window: Build --> Mesh; #98

Open dollPrincess opened 1 month ago

dollPrincess commented 1 month ago

In fact, I want to combine "cylinder" and "cone" for farther use (without applying mesh, just this window (see at picture 0)), but my modifed code failed, and the code create an awful model which is not expected.

0 picture 0 combine "cylinder" and "cone" for farther use without applying mesh, in this window

So I want to use this ordinary function called "merge objects" for comparision, to see if there are somthing I can learn from. My code created this (p1), while the right model may look like this (p2) but the 2 dimensions should be in one object, that's to say, a whole.

1 p1 My code created this

2 p2 the right model may look like this

I don't quite know why, maybe is the wrong order of creation sequence about nodes, edges, faces and so on ?

So Qustion I want to ask is:

  1. When in the build window, clicking on the model you want to generate and not clicking on create, the constructor, fe constructor, create, update and related functions are already called. This call is repeated after clicking create, but this time the call continues from update. Are these the correct steps to call your code for creating a model in the build window?

  2. There is something about building the mesh for calculations that I don't understand. In the build window, when you click on the model you want to create and click create, the code creates the nodes and edges of the dimensional shape and adds them physically to the containers m_node, m_edge, etc. The mesh for computation is initialized in a similar way, for example m_nd = m_ns = 4;m_nz = 8;m_gz = 1;m_gr = 1;; and m_gz = 1

But what actual happens to the mesh used for computation when you click on the model you want to generate in the build window and click on create?

Are the default assignments of "m_nd = m_ns = 4;m_nz = 8;m_gz = 1;m_gr = 1;" the only ones made?

Are the nodes associated with the mesh in the same medium m_node as the nodes that build the dimensional shape?

  1. After creating nodes, edges, blocks and faces in create() function, I would like to know if there are functions to add, modify, delete, etc. the nodes, edges, blocks and faces created in create() function in all possible subsequent operations?

Eagerly awaiting an answer! Sincerely beg you to answer all questions I asked, preferably with the corresponding sub-points listed labeled! Thanks in advance!

SteveMaas1978 commented 1 month ago

It sounds like you are trying to modify the febio studio source code. If so, please note that at this time we do not have any development documentation on febio studio (only on febio) and do not provide support for this. That said, I hope the following comments address your questions:

  1. As soon as you click a button on the Create panel, a temporary instance of the object is allocated. This is necessary in order to show the parameters for the object. After you click create, the object is updated with the parameters entered by the user, and then added to the model.
  2. For primitives (box, cylinder, etc.) the mesh is created via a mesher class (derived from FEMesher), which is allocated in the primitive's constructor. The mesher parameters are shown in the mesh panel. When the user clicks Apply, the mesher is called to generate the mesh for the primitive. The nodes of the geometry are stored on the primitive, but the nodes of the mesh are stored on the mesh.
  3. FEBio Studio has very limited support for creating more complex geometry beyond the simple primitives that we offer. Although it is possible to programmatically create new geometry objects, it's a tedious process. As alternatives, it might be easier to generate your geometry elsewhere (e.g. FreeCAD) and import it in FEBio Studio. If you really want to do it programmatically, FEBio Studio does link to the OpenCascade library, which has powerful geometry generation features. You can look at the GOCCBottle class as an example of a geometry that's build programmatically with OpenCascade.

Hope this helps!

Best,

Steve