Skip to content

Instantly share code, notes, and snippets.

@sbaer
Created December 13, 2013 00:39
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 sbaer/7938220 to your computer and use it in GitHub Desktop.
Save sbaer/7938220 to your computer and use it in GitHub Desktop.
packing arguments as tuples and then unpacking them in the parallel function
import ghpythonlib.components as ghcomp
import ghpythonlib.parallel
#custom function that is executed by parallel.run
def slice_at_angle(args):
brep, plane = args #unpack input
result = ghcomp.BrepXPlane(brep, plane)
if result: return result.curves
if parallel:
items = [(brep, plane) for plane in planes]
slices = ghpythonlib.parallel.run(slice_at_angle, items, True)
else:
slices = ghcomp.BrepXPlane(brep, planes).curves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment