Model construction with Python API

Fabiola
Posts: 16
Joined: Tue Jun 07, 2022 7:50 am

Re: Model construction with Python API

Post by Fabiola » Wed Feb 01, 2023 9:31 pm

Thank you so much!
So now how can i create a quad mesh with pythonAPI?

Fabiola
Posts: 16
Joined: Tue Jun 07, 2022 7:50 am

Re: Model construction with Python API

Post by Fabiola » Mon Feb 13, 2023 6:41 pm

Hi team,
i would like to implement, within my python code, the materials pimy and pdmy to model my soil layers. The parameters are the standard ones for medium clay and medium sand that are on openseeswiki. I attach the file below
thanks for your help!!
Attachments
MakeGeometry - prova PIMY.rar
(3.19 KiB) Downloaded 173 times

STKO Team
Posts: 3066
Joined: Tue Oct 29, 2019 8:45 am

Re: Model construction with Python API

Post by STKO Team » Wed Feb 15, 2023 3:09 pm

Just change these 2 lines (use_rho is not an attribute of PIMY, and PIMY is just in ND folder, without the sub-group name)
Xobj.png
Xobj.png (232.1 KiB) Viewed 3284 times

STKO Team
Posts: 3066
Joined: Tue Oct 29, 2019 8:45 am

Re: Model construction with Python API

Post by STKO Team » Wed Feb 15, 2023 3:19 pm

Add this to the end of your file. By the way, you cannot do a full quad mesh, because of the cuts you have in the deposit shape
mc = doc.meshControls
mesh_size = 10.0
for _, gc in mc.geometryControls.items():
for fc in gc.faceControls:
fc.topology = MpcMeshAlgoTopology.TriaTetra
fc.algorithm = MpcMeshAlgo.Unstructured
for ec in gc.edgeControls:
mesh_seed = MpcMeshEdgeSeed()
mesh_seed.type = MpcMeshEdgeSeedType.UniformBySize
mesh_seed.size = mesh_size
ec.seed = mesh_seed
App.runCommand("BuildMesh")

Fabiola
Posts: 16
Joined: Tue Jun 07, 2022 7:50 am

Re: Model construction with Python API

Post by Fabiola » Mon Feb 20, 2023 9:22 pm

The material PIMY run well for bedrock but not for soil layers. Why?
The error is as follows.
For what concerne the mesh, I have problem with the package MpcMeshAlgoTopology and MpcMeshAlgo too.
Can you help me?
Thank you!!
Fabiola
Attachments
MakeGeometry - prova PIMY 3.rar
(3.31 KiB) Downloaded 173 times
error pimy.PNG
error pimy.PNG (17.72 KiB) Viewed 3251 times

ValentinaSB
Posts: 61
Joined: Thu Dec 09, 2021 10:53 am

Re: Model construction with Python API

Post by ValentinaSB » Tue Feb 21, 2023 2:39 pm

Hi Fabiola,
Regarding the error. Check the indent on lines 178-181. With the correct indent, it works for me. Also, check one more time the indent for your mesh part with for loops. Let me know.

STKO Team
Posts: 3066
Joined: Tue Oct 29, 2019 8:45 am

Re: Model construction with Python API

Post by STKO Team » Wed Feb 22, 2023 8:16 am

As Valentina said, you have indentation issues.
First in line 178 (as the error message says). Here you mixed tabs and whitespaces as indent (this is not allowed in Python). You have to be consistent in your file, either with whitespaces or tabs for indentations, don't mix them.
Secondly, you completely disregarded indentation in the nested for-loops for the meshing part.
Attachments
MakeGeometry - prova PIMY 3.zip
(3.35 KiB) Downloaded 184 times

Fabiola
Posts: 16
Joined: Tue Jun 07, 2022 7:50 am

Re: Model construction with Python API

Post by Fabiola » Thu Mar 02, 2023 5:49 pm

Thank you!
Now the focus of my work is to assign the AbsorbingBoundaries on boundary sides (as in the figure) by API python.
Can you tell me how I can write the tag correctly?
Sorry for all the requests.
I await your reply, thank you again.
Attachments
Absorbing.PNG
Absorbing.PNG (29.51 KiB) Viewed 3164 times

STKO Team
Posts: 3066
Joined: Tue Oct 29, 2019 8:45 am

Re: Model construction with Python API

Post by STKO Team » Mon Mar 06, 2023 8:49 am

I added a code to select all boundary edges for absorbing boundaries.
Now you can proceed as we did for physical and element properties of the main geometry
Attachments
MakeGeometry - prova PIMY 3.zip
(3.72 KiB) Downloaded 183 times

Fabiola
Posts: 16
Joined: Tue Jun 07, 2022 7:50 am

Re: Model construction with Python API

Post by Fabiola » Sun May 21, 2023 5:37 pm

Hello team!
I'm here again to ask for your help. This time i'm modeling directly on STKO and i don't be able to run the analysis. I don't know where i s the problem, maybe it's about the mesh? I don't know how i to do. I attach the file.
Thank you for your help.
Fabiola
Attachments
Schema 1.rar
(364.98 KiB) Downloaded 218 times

Post Reply