Page 2 of 3
Re: Model construction with Python API
Posted: Wed Feb 01, 2023 9:31 pm
by Fabiola
Thank you so much!
So now how can i create a quad mesh with pythonAPI?
Re: Model construction with Python API
Posted: Mon Feb 13, 2023 6:41 pm
by Fabiola
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!!
Re: Model construction with Python API
Posted: Wed Feb 15, 2023 3:09 pm
by STKO Team
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 (232.1 KiB) Viewed 3287 times
Re: Model construction with Python API
Posted: Wed Feb 15, 2023 3:19 pm
by STKO Team
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")
Re: Model construction with Python API
Posted: Mon Feb 20, 2023 9:22 pm
by Fabiola
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
Re: Model construction with Python API
Posted: Tue Feb 21, 2023 2:39 pm
by ValentinaSB
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.
Re: Model construction with Python API
Posted: Wed Feb 22, 2023 8:16 am
by STKO Team
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.
Re: Model construction with Python API
Posted: Thu Mar 02, 2023 5:49 pm
by Fabiola
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.
Re: Model construction with Python API
Posted: Mon Mar 06, 2023 8:49 am
by STKO Team
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
Re: Model construction with Python API
Posted: Sun May 21, 2023 5:37 pm
by Fabiola
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