Is Griddle library available in Rhino with Python?

Hi Itascans,
I would like to create some similar volume meshes with Griddle, could I automatize the process using Python in Rhino?
Thanks!

Hello Carlos!, yes. it is possible!

Thanks Matias.

Where could I find the documentation?

i think you should look into rhino documentation to build python script and directly use the griddle commands into it

1 Like

Hi Carlos. I agree with Matias, the best way to start using Griddle with Python in Rhino is to go through general Python docs and examples. You can start here:

https://developer.rhino3d.com/api/RhinoScriptSyntax/

You can call any Griddle function from Rhino Python using this syntax:

import rhinoscriptsyntax as rs
rs.Command("*Griddle command goes here*")

where Griddle command would be something like this:

rs.Command("_SelAll _GSurf _Mode=Tri _MinEdgeLength=1 _MaxEdgeLength=10 _RidgeAngle=10 _AdvancedParameters _Optimization=5 _ShapeQuality=0.9 _Enter _Enter")

This essentially simulates what you would type in Rhino’s command prompt (instead of clicking on icons). Note that all the keywords have underscore which may be necessary if you have non-English locale on your machine (to properly translate keywords and not get confused with local settings/keywords). Also note that putting _Enter at the end is necessary.

I attached below a relatively complex script which automatically generates and meshes a geometry for a tunnel and DFN around it (currently it creates 30 fractures and orients them randomly according to a Gaussian distribution around average dip and strike angles). At the end, the script creates a tetrahedral volume mesh and automatically outputs it for 3DEC. It is currently set to run 2 realizations. To run the script, save an empty Rhino 8 project at the same location as the initial DXF and .py file. The script is rather complex but it has many comments and you can reuse parts of it for other scripts.

DFN_mesh.zip (33.9 KB)

2 Likes

Many thanks Andrey, sorry for the late answer I have not seen your code and explanation. I much appreciate your code :heart_eyes:, it can very helpful for me because I am starting with DFN and the new feature ‘rock joints’ in FLAC3D v.9. Also, I will learn how to use Griddle in Python and more.

Is it possible to create such geometry and mesh it without Griddle ?

I am sure that with some work you can create and mesh such geometry in 3DEC by appropriately cutting blocks from a solid. If you have questions about it, please post in 3DEC thread.

(sorry for replying here, i tried to create a new question but couldnt) This example can be ran in FLAC 3D too right ? and the same intersecting fractures can be created with the same intensity ?

This python script is developed for and runs in Rhino 8 (not in FLAC3D or 3DEC). It also requires Griddle 2.0 to be installed. However, you can quickly modify the output grid file format in this script to create grids either for FLAC3D or 3DEC. Use/uncomment the appropriate line:

  • for 3DEC: gvolStr += "_OutputFormat=3DEC_7x _FormatType=Binary _BlockType=Deformable "
  • for FLAC3D: gvolStr += "_OutputFormat=FLAC3D _FormatType=Binary "

You can find this line close to the end of function MakeTunnelWithDFN().

Note that if you use 3DEC output, deformable blocks separated by the fractures will be produced. In case of FLAC3D, zones separated by fractures are produced. You can also change the number and orientation of the fractures in the script and even modify the geometry of the model as needed.

2 Likes