Created
December 13, 2013 00:39
-
-
Save sbaer/7938220 to your computer and use it in GitHub Desktop.
packing arguments as tuples and then unpacking them in the parallel function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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