import numpy as np from myplot import plot_verticles vertices = np.array([ [-3, -3, 0], [+3, -3, 0], [+3, +3, 0], [-3, +3, 0], [+0, +0, +3] ]) plot_verticles(vertices = vertices, isosurf = False) plot_verticles(vertices = vertices, isosurf = True) array([ [4, 1, 0], [4, 2, 1], [3, 4, 0], [3, 4, 2], [3, 2, 1], [3, 1, 0] ], dtype=int32) myramid_mesh = mesh.Mesh( np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype) ) for i, f in enumerate(faces): for j in range(3): myramid_mesh.vectors[i][j] = vertices[f[j],:] plot_mesh(myramid_mesh) import matplotlib.pyplot as plt from scipy import spatial import numpy as np points = np.array([ [0,0], [-2,0], [-2,2], [0,1.5], [2,2], [2,0] ]) hull = spatial.ConvexHull(points) array([ [2, 1], [2, 4], [5, 1], [5, 4] ], dtype=int32) plt.plot(points[:,0], points[:,1], 'o') for simplex in hull.simplices: plt.plot(points[simplex, 0], points[simplex, 1], 'k-') plt.plot(points[:,0], points[:,1], 'o') for simplex in hull.simplices: plt.plot(points[simplex, 0], points[simplex, 1], 'k-') import pymesh box_a = pymesh.generate_box_mesh([0,0,0], [1,1,1]) filename = "/pymesh_examples/pymesh_example_01.stl" pymesh.save_mesh(filename, box_a, ascii=False) import pymesh box_a = pymesh.generate_box_mesh([0,0,0], [1,1,1]) box_b = pymesh.generate_box_mesh([0.4,0.4,0], [0.6,0.6,1]) box_c = pymesh.boolean( box_a, box_b, operation='difference', engine="igl" ) filename = "/pymesh_examples/pymesh_example_02.stl" pymesh.save_mesh(filename, box_c, ascii=False) from solid import * d = difference()( cube(size = 10, center = True), sphere(r = 6.5, segments=300) ) path = scad_render_to_file(d, 'solidpython_example_01.scad') from solid import * c = circle(r = 1) t = translate([2, 0, 0]) (c) e = linear_extrude( height = 10, center = True, convexity = 10, twist = -500, slices = 500 ) (t) col = color('lightgreen') (e) path = scad_render_to_file(col, 'solidpython_example_02.scad')