Skip to content

Instantly share code, notes, and snippets.

@sbaer

sbaer/gist:7938220

Created Dec 13, 2013
Embed
What would you like to do?
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