Skip to content

Commit

Permalink
3D -> 2D; xy working; xz, yz not working
Browse files Browse the repository at this point in the history
  • Loading branch information
neilger committed Jul 13, 2015
1 parent eca5cb0 commit 9aa8aa0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
18 changes: 18 additions & 0 deletions py/nodes/3D → 2D/slice_xy.node
@@ -0,0 +1,18 @@
# Neil Gershenfeld 7/12/15

import fab
from fab.types import Shape

title('Slice xy')

def slice_xy(shape,z):
slice_math = shape.math.replace('Z','f('+str(z)+')')
return Shape(slice_math,
shape.bounds.xmin,shape.bounds.ymin,
shape.bounds.xmax,shape.bounds.ymax)

input('shape',fab.types.Shape)
input('z',float,0)

output('slice',slice_xy(shape,z))

19 changes: 19 additions & 0 deletions py/nodes/3D → 2D/slice_xz.node
@@ -0,0 +1,19 @@
# Neil Gershenfeld 7/12/15

import fab
from fab.types import Shape

title('Slice xz')

def slice_xz(shape,y):
slice_math = shape.math.replace('Y','f('+str(y)+')')
slice_math = slice_math.replace('Z','Y')
return Shape(slice_math,
shape.bounds.xmin,shape.bounds.zmin,
shape.bounds.xmax,shape.bounds.zmax)

input('shape',fab.types.Shape)
input('y',float,0)

output('slice',slice_xz(shape,y))

20 changes: 20 additions & 0 deletions py/nodes/3D → 2D/slice_yz.node
@@ -0,0 +1,20 @@
# Neil Gershenfeld 7/12/15

import fab
from fab.types import Shape

title('Slice yz')

def slice_yz(shape,x):
slice_math = shape.math.replace('X','f('+str(x)+')')
slice_math = slice_math.replace('Y','X')
slice_math = slice_math.replace('Z','Y')
return Shape(slice_math,
shape.bounds.ymin,shape.bounds.zmin,
shape.bounds.ymax,shape.bounds.zmax)

input('shape',fab.types.Shape)
input('x',float,0)

output('slice',slice_yz(shape,x))

0 comments on commit 9aa8aa0

Please sign in to comment.