prnthp / opensim-stl-export

Want to export a model from OpenSim to STL? Wegotchufam.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

💪💪💪 Export OpenSim 4.0 models to STL

Want to export a model from OpenSim? igotchufam. wow

Tutorial

  1. Convert all Geometry files to STL. Either use your favorite program or if it's a VTP file, use the included converter. python vtp2stl.py Geometry -o Geometry should work for most models.
  2. Edit the .osim file and change all mesh references to the new STL files. e.g. Find & Replace .vtp with .stl using your favorite text editor.
  3. python exportSTL.py your-opensim-file.osim -o your-export-directory default directory is output
  4. python exportSTL.py your-opensim-file.osim -o your-export-directory -j exports only the meshless bodies and joints

Dependencies

  1. Python 2.7 Environment
  2. OpenSim Python Wrapper
  3. numpy
  4. numpy-stl
  5. vtk (for the vtp2stl conversion)

Setup

I highly recommend you create a new Python env in conda because of the strict Python 2.7 requirement and OpenSim's setup process

  1. conda create -n opensin python=2.7
  2. conda activate opensin or activate opensin
  3. Follow OpenSim 4.0 installation here (YMMV for MacOS!)
  4. conda install numpy numpy-stl
  5. Optional for vtp2stl.py conda install vtk

Whazzat reference_cube.stl & reference_arrow.stl

  • reference_cube.stl: Bodies with no mesh will have that in place. Replace that with your own stl file if you prefer other brilliant shapes. Also it's not actually a cube, but it makes up the coordinate axes x, y and z.
  • refernce_arrow.stl: The "arrow" will point to the joint's axis, and the "arrow's width" will point to the current angle of the coordinate.

Limitations

It's a quick and dirty thing I threw together. So it only exports the first attached mesh of each body. Please extend this and help make OpenSim more friendly for engineers!

Wait I came here for that virtual world sim

This is for the other OpenSim.

About

Want to export a model from OpenSim to STL? Wegotchufam.

License:MIT License


Languages

Language:Python 100.0%