Open joaoantoniocardoso opened 3 years ago
Hi Joao,
Thank you for using Meshmagick :)
Concerning your problem, just note that the IO functions like load_VTP are not returning a Mesh instance but two arrays V and F containing vertices coordinates and faces definition that are used to instantiate a Mesh object. Something like (not tested) should do the job:
from meshmagick import mmio, hydrostatics, mesh
V, F = mmio.load_VTP("./meshmagick/tests/data/SEAREV.vtp")
mymesh = mesh.Mesh(V, F)
hydrostatics.Hydrostatics(mymesh)
Have a good day, François
Hi @frongere,
Thank you for your attention, you are absolutely right! Reading the meshmagick_cli.py I ended with the following example. Maybe we could add something like this as a basic usage example?
from meshmagick import mmio, hydrostatics, mesh
V, F = mmio.load_VTP("./meshmagick/tests/data/SEAREV.vtp")
mymesh = mesh.Mesh(V, F)
mymesh.heal_triangles()
hs_solver = hydrostatics.Hydrostatics(mymesh, verbose=True)
disp = 1500
cog = (0, 4, -2)
hs_solver.mass = disp
hs_solver.gravity_center = cog
hs_solver.equilibrate(init_disp=False)
print(hs_solver.get_hydrostatic_report())
hs_solver.show()
Hi, first I want to say thank you to the developer and contributors of this software/package, I was just looking for a way for computing hydrostatics from Python and finally found it! :smile:
Well, I just executed some of the example lines from cli mentioned in the documentation and all worked fine.
But then I moved to the Python package, but I am facing some trouble here. I tried with both
python2.7
andpython3.8
using a freshvirtualenv
/venv
, installing it by runningpip install https://github.com/LHEEA/meshmagick/archive/master.zip
.Minimal example
and got:
Let me know If you need more information or some help, I am a developer too and I am open to contribute to open source projects :+1:
Thank you!