Skip to content

Instantly share code, notes, and snippets.

@akrolsmir
Created September 21, 2015 07:49
Show Gist options
  • Save akrolsmir/675be68df9c2568f89ef to your computer and use it in GitHub Desktop.
Save akrolsmir/675be68df9c2568f89ef to your computer and use it in GitHub Desktop.

PolyLines - 2D

Creating:

polyline = PolyLine([[0,0],[0,10],[10,0],[0,0]])
polyline = PolyLine(generator=solid_object_2D)

Checking:

polyline.show()

solid - 2D or 3D

Most functions in the OpenSCAD cheat sheet have an analogue here.

Creating:

solid_object = solid.cylinder()
solid_object = polyline.get_generator()
solid_object = polymesh.get_generator()

Checking:

solid.scad_render_to_file(solid_object, "output.scad")

# Convenience functions you might want to define
def solid_write(solid_object):
	"""Writes out solidpython object"""
	solid.scad_render_to_file(solid_object, "output.scad")

import os
def solid_show(solid_object):
	"""Writes out solidpython object, then shows it in OpenSCAD"""
	solid_write(solid_object)
	os.system('openscad output.scad &')

Gotchas: When an numpy array is input, the commas may be removed. For example, solid.polygon(points=numpy.array([[...]])) won't render correctly.

PolyMesh - 3D

Creating:

polymesh = PolyMesh(generator=solid_object_3D)

Checking:

polymesh.save("polymesh.scad")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment