LoopStructural
LoopStructural copied to clipboard
[Question]Export issues
Hi, I would like to ask how to export the model into a file. When I tried to use exporters.py for exporting, various errors occurred. I would appreciate it if you could help me resolve my doubts. Thank you.
Hi, currently there is no exporting available. You can use the visualisation class and export the triangles and nodes for the surfaces.
In the future there will be direct import for various surface formats.
Hi,
Along the same lines, I'm trying to use write_feat_surfs() from exporters.py. I get the warning "For {featurename} isovalue {isovalue} doesn't exist inside bounding box, skipping"
from here:
if isovalue > np.nanmax(val) or isovalue < np.nanmin(val):
logger.warning(
f"For {featurename} isovalue {isovalue} doesn't exist inside bounding box, skipping"
)
return False, []
Going back a few lines, the error appears to stem from model.bounding_box, which only contains zeros.
When bounding_box is initialised in GeologicalModel it looks to go from 0 to the width/height of the model bounds, rather than from the origin to the maximum. I tried setting the bounding_box to go from origin to maximum, but it threw a bunch of other errors - I'm not sure of the intent of bounding_box.
It looks like most of the code to export features to file (and to get the vertex/face etc arrays for integration into other code) is already there.
BTW, I've just started looking into Loop3D. It looks great - thank you for your work and making it open source. Lots to learn!
Regards, Roland
Hi @rolandhill,
The code you are trying to use from the exporter module is not up to date, it was code that was added into LoopStructral to be able to export the loopstructural models/surfaces into other software. It hasn't been in my workflow and there were no tests so it needs some refactoring.
In the next release which I am currently working on I have made an abstract type for surfaces, scalar fields and data objects from LoopStructural. The idea is that these types will be able to be exported to various formats e.g. vtk, obj, geoh5, gocad, json etc. I will update this issue when the version is working.
Cheers,
Lachlan
Thanks, Lachlan. I'm looking forward to the next release.
Will this also include access to the vertex, face, normal etc arrays to pull geometry directly into other applications?
Cheers, Roland
Yes. The current data structure for surfaces is here.
There will be a similar structure for points, grids and vector fields. So it should be easy to convert into other applications.
Hi,
When using the function write_feat_surfs(model=model, featurename, file_format, file_name), UNIT how these geologic units are output. Or what should be the featurename to output the unit.
Regards,
fjp
Hi, @fjphhxx please use the newest version of LoopStructural and export the surfaces using the
for s in model[featurename].surfaces([isovalue1,isovalue2]):
s.save('surface.vtk')
You can export surfaces in gocad tsurf .ts, mira's geoscience analyst .geoh5, json, obj, vtk, or pickle the python object. The save function will interpret the file type from the extension you choose.
or you can write your own exporter using the surface datatype using surface.vertices and surface.triangles
@rolandhill the Surface, ValuePoints, VectorPoints and StructuredGrid datatypes should also be of interest to you.
Thanks, Lachlan. Awesome, I'm going to try it. But now I have a problem, how do I upgrade the loop to version 1.6.
You should be able to upgrade with pip or conda... pip install -upgrade LoopStructural
On Fri, 7 June 2024, 4:42 pm fjphhxx, @.***> wrote:
Thanks, Lachlan. Awesome, I'm going to try it. But now I have a problem, how do I upgrade the loop to version 1.6.
— Reply to this email directly, view it on GitHub https://github.com/Loop3D/LoopStructural/issues/188#issuecomment-2154193954, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYHZAEK7NKJ5SVZM65JWJTZGFI6RAVCNFSM6AAAAABI5ZVVU2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJUGE4TGOJVGQ . You are receiving this because you commented.Message ID: @.***>
Thank you. I've upgraded successfully. But there are some problems when using it, such as AttributeError: 'Loop3DView' object has no attribute 'interactive'. Is the Interactive function no longer available?
Thanks, Lachlan. I'll give it a try next week probably.
Regards, Roland
On Fri, 7 Jun 2024 at 14:29, Lachlan Grose @.***> wrote:
Hi, @fjphhxx https://github.com/fjphhxx please use the newest version of LoopStructural and export the surfaces using the
for s in model[featurename].surfaces([isovalue1,isovalue2]): s.save('surface.vtk')
You can export surfaces in gocad tsurf .ts, mira's geoscience analyst .geoh5, json, obj, vtk, or pickle the python object. The save function will interpret the file type from the extension you choose.
or you can write your own exporter using the surface datatype using surface.vertices and surface.triangles
@rolandhill https://github.com/rolandhill the Surface, ValuePoints, VectorPoints and StructuredGrid datatypes should also be of interest to you.
— Reply to this email directly, view it on GitHub https://github.com/Loop3D/LoopStructural/issues/188#issuecomment-2153918684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPOEQYQWRGTHJ77PO5JRTTZGEZMBAVCNFSM6AAAAABI5ZVVU2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJTHEYTQNRYGQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi @fjphhxx,
Loop3DView is not the same as the lavavu visualisation. The Loop3DView wraps the pyvista Plotter class, so you will need to adjust any visualisation code.
view.show() will display the plot using an interactive widget if you have a compatible installation of pyvista (use the loopstructuralvisualisation[jupyter] package to install this.