Skip to content

Instantly share code, notes, and snippets.

@kogcyc
Created February 6, 2019 22:12
Show Gist options
  • Save kogcyc/562e9476acff251c28e9a64c7c300ecc to your computer and use it in GitHub Desktop.
Save kogcyc/562e9476acff251c28e9a64c7c300ecc to your computer and use it in GitHub Desktop.
change a PovRAY 'prism' object, which was generated by Inkscape, into a 'lathe' object ( povray prism lathe )
import sys
fo = open(sys.argv[1] + '.pov')
a = fo.read()
fo.close()
b = a.find('prism')
c = a[b:]
d = c.find('}')
e = c[:d+1]
f = e.replace('prism','#declare ' + sys.argv[1] + ' = ' + 'lathe')
g = f.replace(' linear_sweep\n','')
h = g.replace(' 1.0, //top\n','')
i = h.replace(' 0.0, //bottom\n','')
print(i)
fo = open(sys.argv[1] + '.inc','w')
fo.write(i)
fo.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment