def set_parallel_mode(flag): """ Global option to set the Boolean operations for parallel execution. :param bool flag: Option for parallel execution. *True* turns parallel execution on, *False* turns it off. :return: None. """ BOPAlgo_Options.SetParallelMode_(flag)
import time from OCCT.BOPAlgo import BOPAlgo_Options from OCCT.BRepAlgoAPI import BRepAlgoAPI_Fuse from OCCT.TopTools import TopTools_ListOfShape from OCCT.Exchange import ExchangeBasic from OCCT.Visualization import BasicViewer fn = './models/wing_assy.brep' wing_assy = ExchangeBasic.read_brep(fn) fn = './models/fuse_assy.brep' fuse_assy = ExchangeBasic.read_brep(fn) BOPAlgo_Options.SetParallelMode_(True) bop = BRepAlgoAPI_Fuse() args = TopTools_ListOfShape() args.Append(wing_assy) bop.SetArguments(args) tools = TopTools_ListOfShape() tools.Append(fuse_assy) bop.SetTools(tools) print('Starting fuse...') start = time.time() bop.Build() print('Complete in ', time.time() - start, ' seconds.') v = BasicViewer() v.add(bop.Shape()) v.start()