Closed glory21 closed 5 months ago
Hello @glory21,
we appreciate you using gempy and we hope you have a good experience. We would also appreciate if you take a little time to formulate your issues (e.g using the template) and maybe say hello.
Regarding your problem. Gempy v3 does not have the functionality to save the complete model. You can however easiliy access all results using geo_model.solutions.raw_arrays
. All results are saved there. If you can give me more specifics on what exactly you need I can probably give you more specific directions.
Cheers;
Jan
@javoha, I think what @glory21 needs is an extraction of the PyVista meshes from the GemPy Model. GemGIS has this functionality implemented for GemPy< 3 but I have not tested it yet for GemPy 3. But I will do so soonish and can report then.
OK, so all the resulting dual contouring meshes are in geo_model.solutions.dc_meshes
.
Does that work for you?
Thank you very much for your reply. I am trying to save the built 3D mesh model as a model file, such as the a 3D mesh obj file, so that the modeling results can be used in other 3D modeling software.
@javoha, I think what @glory21 needs is an extraction of the PyVista meshes from the GemPy Model. GemGIS has this functionality implemented for GemPy< 3 but I have not tested it yet for GemPy 3. But I will do so soonish and can report then.
Thank you very much for your reply. I am trying to use gempy2.3.1 to save model. And I ran the code but there was an error:
vertices, faces = gp.get_surfaces(geo_data)
x0, y0, z0 = 0, 0, 0
cells = [] for i in range(len(vertices)):
shifted_vertices = vertices[i] - [x0, y0, z0]
# create cells (faces) dictionary
cells.append({"triangle": faces[i]})
# print the number of vertices for each surface
print(f"Surface {i} has {len(shifted_vertices)} vertices.")
meshio.write_obj("model.obj", np.vstack(vertices), cells)
error: vertices, faces = gp.get_surfaces(geo_data) AttributeError: module 'gempy' has no attribute 'get_surfaces'
Hi, is there any specific reason why you are not using the new gempy version. For the old version there is the gempy_legacy repository. Cheers Jan
Thanks! I have addressed the problem and save the model as a VTK file by running the following codes.
dict_SimpleMafic2 = gg.visualization.create_depth_maps_from_gempy(geo_model=data, surfaces='SimpleMafic2') dict_SimpleMafic2['SimpleMafic2'][0].save('Layer1.vtk')
Happy to hear, I will close this issue then. Just maybe as a general advice - I would try to switch to gempy v3 rather sooner than later, as the legacy version will not be supported anymore. So transfering to the new version makes a lot of sense. Cheers and have fun modelling, Jan
How do I save the model? for example as an obj file.