Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created September 13, 2016 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/b8e1531dc6c6b87ac7c6556bb5f66c69 to your computer and use it in GitHub Desktop.
Save zeffii/b8e1531dc6c6b87ac7c6556bb5f66c69 to your computer and use it in GitHub Desktop.
from sverchok.utils.geom import grids, sn1_autowrap
def sn1_feed_params(sockets, var_dict):
'''only works if socketname is identical to variable name'''
return {k: var_dict[k] for s, k, v in sockets}
def sv_main(dim_x=1.0, dim_y=1.62, nx=2, ny=2, anchor=0):
in_sockets = [
['s', 'dim_x', dim_x],
['s', 'dim_y', dim_y],
['s', 'nx', nx],
['s', 'ny', ny],
['s', 'anchor', anchor]]
dim_x, dim_y, nx, ny, anchor = sn1_autowrap(dim_x, dim_y, nx, ny, anchor)
_v, _e, _f = [], [], []
for geom in grids(**sn1_feed_params(in_sockets, vars())):
_v.append(geom[0])
_e.append(geom[1])
_f.append(geom[2])
out_sockets = [
['v', 'verts', _v],
['s', 'faces', _f]
]
return in_sockets, out_sockets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment