taxpon / openpyscad

Python library to generate OpenSCAD source code. This library provides intuitive interface when you handle 3D data.
https://pypi.org/project/openpyscad/
MIT License
119 stars 21 forks source link

openpyscad as a python wrapper for openscad #29

Open edmundsj opened 4 years ago

edmundsj commented 4 years ago

Have you thought about turning openpyscad into a full wrapper for openscad, instead of just a source code generator? I think it would require minimal additional effort depending on how it is done, as openscad has a command line API, so you could just invoke openscad and, for example, directly generate an STL file, i.e.:

import openpyscad as ops

ops.Cube([10, 10, 10]).write('input.scad')
os.system('openscad -o output.stl input.scad')

Or directly open the viewer:

import openpyscad as ops

ops.Cube([10, 10, 10]).write('input.scad')
os.system('openscad input.scad')

This would be nice for those of us (me) that love to work in python as much as possible and hate working in other people's UIs/programs except for stuff like simple viewing. An example of a software package that does this well is gdspy. It provides all the logic for generating structures and a (very) simple viewer for the output file, and is a very popular package. You could even perhaps bundle openscad and openpyscad as a single conda package.

lingster commented 3 years ago

This sounds like an interesting idea. Just checking on the openscad command line api: [openscad api] (https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_environment) and it would be fairly straight foward to create a class to wrap around all the command lines api.

taxpon commented 3 years ago

Thanks, let me look into this.