Rebuild the FEM model
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Rebuild the FEM model
If I have a FreeCAD FEM model, which contains the following actions
1. Import the STEP file.
2. Apply materials, BC and Loading
3. Meshing
4. solve and post-processing
If I change the geometry in the STEP file of STEP 1 with an external CAD, is there any way I can rebuild the whole model and solve (step 1 to 4) without redo all the steps above ?
Thanks for the help.
Regards
S-Y. Chen
1. Import the STEP file.
2. Apply materials, BC and Loading
3. Meshing
4. solve and post-processing
If I change the geometry in the STEP file of STEP 1 with an external CAD, is there any way I can rebuild the whole model and solve (step 1 to 4) without redo all the steps above ?
Thanks for the help.
Regards
S-Y. Chen
Re: Rebuild the FEM model
With python for sure lot of things could be automated. How much afford is needed depends on the changes in your geometry. Do you change the length of edges only? Means the count of nodes, edges, faces is still the same? Or do you really change the geometry? Means you add or delete edges. Would be good if you post two examples of the changed geometry.S-Y.Chen wrote: ↑Fri May 29, 2020 5:59 am If I have a FreeCAD FEM model, which contains the following actions
1. Import the STEP file.
2. Apply materials, BC and Loading
3. Meshing
4. solve and post-processing
If I change the geometry in the STEP file of STEP 1 with an external CAD, is there any way I can rebuild the whole model and solve (step 1 to 4) without redo all the steps above ?
Thanks for the help.
Regards
S-Y. Chen
Re: Rebuild the FEM model
The topology of the CAD won't be changed. That means, yes, the count of nodes, edges, faces is still the same. And the ID of each CAD entity should remains the same.bernd wrote: ↑Fri May 29, 2020 7:05 amWith python for sure lot of things could be automated. How much afford is needed depends on the changes in your geometry. Do you change the length of edges only? Means the count of nodes, edges, faces is still the same? Or do you really change the geometry? Means you add or delete edges. Would be good if you post two examples of the changed geometry.S-Y.Chen wrote: ↑Fri May 29, 2020 5:59 am If I have a FreeCAD FEM model, which contains the following actions
1. Import the STEP file.
2. Apply materials, BC and Loading
3. Meshing
4. solve and post-processing
If I change the geometry in the STEP file of STEP 1 with an external CAD, is there any way I can rebuild the whole model and solve (step 1 to 4) without redo all the steps above ?
Thanks for the help.
Regards
S-Y. Chen
Re: Rebuild the FEM model
Two STEP files attached here.S-Y.Chen wrote: ↑Fri May 29, 2020 7:08 amThe topology of the CAD won't be changed. That means, yes, the count of nodes, edges, faces is still the same. And the ID of each CAD entity should remains the same.bernd wrote: ↑Fri May 29, 2020 7:05 amWith python for sure lot of things could be automated. How much afford is needed depends on the changes in your geometry. Do you change the length of edges only? Means the count of nodes, edges, faces is still the same? Or do you really change the geometry? Means you add or delete edges. Would be good if you post two examples of the changed geometry.S-Y.Chen wrote: ↑Fri May 29, 2020 5:59 am If I have a FreeCAD FEM model, which contains the following actions
1. Import the STEP file.
2. Apply materials, BC and Loading
3. Meshing
4. solve and post-processing
If I change the geometry in the STEP file of STEP 1 with an external CAD, is there any way I can rebuild the whole model and solve (step 1 to 4) without redo all the steps above ?
Thanks for the help.
Regards
S-Y. Chen
- Attachments
-
- examp112_02.STEP
- (15.63 KiB) Downloaded 34 times
-
- examp112_01.STEP
- (15.62 KiB) Downloaded 33 times
Re: Rebuild the FEM model
- open document, run analysis, show results
- run Python code
- recompute document
- remesh (if netgen mesh is used, the mesh will be chaned on document recompute)
- run analysis, show results
- run Python code
Code: Select all
App.ActiveDocument.FEMGeom.Shape = App.ActiveDocument.getObjectsByLabel("examp112")[0].Shape
- remesh (if netgen mesh is used, the mesh will be chaned on document recompute)
- run analysis, show results
Re: Rebuild the FEM model
Sorry, I don't quite understand the process and logics.bernd wrote: ↑Fri May 29, 2020 9:24 am - open document, run analysis, show results
- run Python code- recompute documentCode: Select all
App.ActiveDocument.FEMGeom.Shape = App.ActiveDocument.getObjectsByLabel("examp112")[0].Shape
- remesh (if netgen mesh is used, the mesh will be chaned on document recompute)
- run analysis, show results
change_geometry_fem.FCStd
In the first action "- open document, run analysis, show results". Does this mean that model already imported the original STEP model ? (my step 1 tp 4?)
And, when does the change of the STEP file comes into effect ? And what does this line of code do ?
Re: Rebuild the FEM model
in the file is a FEM analysis which uses one ouf your geometries. The line of code does exchange the geometry of the geometrical document object from one of your geometries to the other. The attribute which holds the geometry is called Shape. Afte the geometry was exchanged the document needs recompute. The loads and fixed are adapted. Now the mesh needs do be remeshed and the analysis could be run with the exchaned geometry. Hope this helps.
At the moment the geoemtry exchange can not be done by the Gui AFAIK, but I am not sure. For reference: https://forum.freecadweb.org/viewtopic.php?f=8&t=46975
At the moment the geoemtry exchange can not be done by the Gui AFAIK, but I am not sure. For reference: https://forum.freecadweb.org/viewtopic.php?f=8&t=46975
Re: Rebuild the FEM model
Script should work perfectly for me at this point. Thank you.
I did give it a try. And I am wondering how does FreeCAD decide the name of the newly imported "geometrical document object" ? Is there a way to obtain this name (through script), assuming that we need to know it in batch mode execution ?
Thank again for the help.
I did give it a try. And I am wondering how does FreeCAD decide the name of the newly imported "geometrical document object" ? Is there a way to obtain this name (through script), assuming that we need to know it in batch mode execution ?
Thank again for the help.
Re: Rebuild the FEM model
be aware there is a Name and a Label for each document object. Which one of both are you talking about?
Re: Rebuild the FEM model
Actually I just figure out there are two names (label) to be used, so I am talking about both. How do I get both name and label through script ?
And I gave it a try on my own model. I imported a STEP file examp104_01, and setup the FEM and run. And then I imported a STEP file examp104_02 again, as shown in the figure below Then i issued the command
App.ActiveDocument.examp104_01.Shape = App.ActiveDocument.getObjectsByLabel("examp104_02")[0].Shape
But I got the following error message :
AttributeError: 'App.Document' object has no attribute 'examp104_01'
What did I do wrong here ?
Thanks again for the help !
Regard
S-Y. Chen
And I gave it a try on my own model. I imported a STEP file examp104_01, and setup the FEM and run. And then I imported a STEP file examp104_02 again, as shown in the figure below Then i issued the command
App.ActiveDocument.examp104_01.Shape = App.ActiveDocument.getObjectsByLabel("examp104_02")[0].Shape
But I got the following error message :
AttributeError: 'App.Document' object has no attribute 'examp104_01'
What did I do wrong here ?
Thanks again for the help !
Regard
S-Y. Chen