Skip to content

Instantly share code, notes, and snippets.

@jstults
Created January 24, 2019 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstults/3e6e1ac5958ad50f213f3dddff2c3ac1 to your computer and use it in GitHub Desktop.
Save jstults/3e6e1ac5958ad50f213f3dddff2c3ac1 to your computer and use it in GitHub Desktop.
python script to run InverseCSG on an example part from OpenLSTO based on the run_tests script that ships with InverseCSG
import os
import sys
# Usage: python3 topopt2CSG.py <build_dir> <test_name>
# Example:
# python3 topopt2CSG.py ../build openlsto
#
if len(sys.argv) < 3:
print('Error: please specify the test case name.')
sys.exit(-1)
build_dir = sys.argv[1]
test_name = sys.argv[2]
if test_name == 'openlsto':
os.system('python3 ../inverse_csg/main.py --builddir %s --outdir ../openlsto --mesh ../openlsto/mystlfile-openscad-import.off --eps 0.1 --surfacedensity 100 --volumedensity 10' % build_dir)
else:
print('Unknown test case: %s' % test_name)
sys.exit(-1)
@jstults
Copy link
Author

jstults commented Jan 24, 2019

for a post on combining OpenLSTO and InverseCSG for topology optimization interpretation:
http://www.variousconsequences.com/2019/01/openlsto-plus-inversecsg.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment