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()
gui = BasicViewer() def axis(): p1 = gp_Pnt(2., 3., 4.) d = gp_Dir(4., 5., 6.) a = gp_Ax3(p1, d) a_IsDirect = a.Direct() print("a is direct:", a_IsDirect) # a_XDirection = a.XDirection() # a_YDirection = a.YDirection() p2 = gp_Pnt(5., 3., 4.) a2 = gp_Ax3(p2, d) a2.YReverse() # axis3 is now left handed a2_IsDirect = a2.Direct() print("a2 is direct:", a2_IsDirect) # a2_XDirection = a2.XDirection() # a2_YDirection = a2.YDirection() gui.add(p1) gui.add(p2) def exit(event=None): sys.exit() if __name__ == '__main__': axis() gui.start()