Hi! I'm trying to convert a few geometry files used in the MoBL-ARMS model (https://simtk.org/projects/upexdyn) from binary to ascii format.
For background, when I try to open some of the bones used in the MoBL-ARMS model (in OpenSim 4.0+), I get an error that only ASCII format is accepted. (Screenshot attached.)
I'm trying to run vtpbinary2ascii.py (more info here: https://github.com/opensim-org/opensim-models/issues/38) to convert the bones that are in binary to ASCII, but am running into a Python issue. When I try to run this vtpbinary2ascii.py script, I get an error that says "no module named vtk." How do I go about installing the vtk module? I'm brand new to Python, so I'm not sure how to access this vtk module to get the vtpbinary2ascii.py working?
Thanks! If any other info would be helpful, let me know & I'm happy to share
Katie
Binary .vtp files to ascii for geometry files
- Katie Blessinger
- Posts: 14
- Joined: Mon Sep 13, 2021 11:21 am
Binary .vtp files to ascii for geometry files
- Attachments
-
- error from vtk module in python
- ASCIIerror4forum_python.JPG (48.51 KiB) Viewed 603 times
-
- error in OpenSim
- ASCIIerror4forum.JPG (53.71 KiB) Viewed 603 times
Tags:
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Binary .vtp files to ascii for geometry files
Hi Katie,
If working in python and using vtk you need to install the vtk module first, how you do that depends on your environment (e.g. conda? spyder? etc.) this falls outside the scope of OpenSim but is easily found online.
Hope this helps,
-Ayman
If working in python and using vtk you need to install the vtk module first, how you do that depends on your environment (e.g. conda? spyder? etc.) this falls outside the scope of OpenSim but is easily found online.
Hope this helps,
-Ayman
- Katie Blessinger
- Posts: 14
- Joined: Mon Sep 13, 2021 11:21 am
- Bryce Killen
- Posts: 104
- Joined: Mon Nov 24, 2014 7:12 pm
Re: Binary .vtp files to ascii for geometry files
Example in case you have not found one
Code: Select all
import vtk
from tkinter.filedialog import askopenfilename
binSTL = askopenfilename(title = ' Select the binary STL to convert ... ')
binSTL = str(binSTL)
stlR = vtk.vtkSTLReader()
stlR.SetFileName(binSTL)
stlR.Update()
polyData = stlR.GetOutput()
ascSTL = binSTL[:-4] + '_asc.stl'
stlW = vtk.vtkSTLWriter()
stlW.SetInputData(polyData)
#stlW.SetFileTypeToASCII()
stlW.SetFileTypeToBinary()
stlW.SetFileName(ascSTL)
stlW.Write()
print (' ASCII STL saved .. ')