def Display_Shape(self, colors=["BLUE", "YELLOW"]): self.display.DisplayShape(axs_pln(gp_Ax3())) self.display.DisplayShape(axs_pln(self.ini.axs), color=colors[0]) self.display.DisplayShape(axs_pln(self.tar.axs), color=colors[1]) self.display.DisplayShape(self.ini.srf, color=colors[0]) self.display.DisplayShape(self.tar.srf) self.display.DisplayShape(self.ini.beam.Location(), color=colors[0]) self.display.DisplayShape(self.tar.beam.Location(), color=colors[1]) self.display.DisplayShape(make_line(self.ini.beam.Location(), self.tar.beam.Location()), color=colors[0]) self.display.FitAll()
def Display_Update(self): self.display.EraseAll() self.display.DisplayShape(axs_pln(gp_Ax3())) self.display.DisplayShape(axs_pln(self.ini.axs)) self.display.DisplayShape(axs_pln(self.tar.axs)) self.display.DisplayShape(self.ini.srf) self.display.DisplayShape(self.tar.srf) self.display.DisplayShape(self.ini.sxy, color="BLUE") self.display.DisplayShape(self.tar.sxy, color="YELLOW") self.display.DisplayShape(make_line(self.ini.sxy, self.tar.sxy)) self.display.FitAll() self.start_display()
shpe = read_iges(opt.dir + opt.file) else: print("Incorrect file index") sys.exit(0) print(shpe) axs = gp_Ax3(gp_Pnt(10, 10, 10), gp_Dir(0, 0, 1)) Transform(gp_Ax3(), axs, shpe) display, start_display, add_menu, add_function_to_menu = init_display() viewer = Viewer() viewer.on_select() #add_menu ("Viewer") #add_function_to_menu ("Viewer", SetViewer) ex_obj = ExportMethod() for shp in shpe: ex_obj.add_shpe(shp) ex_obj.fileout(opt.out + opt.fileout) SetViewer() display.DisplayShape(shpe) display.DisplayShape(axs_pln(gp_Ax3())) display.DisplayShape(axs_pln(axs)) display.DisplayShape(gp_Pnt()) display.FitAll() start_display()
parser.add_option("--dir", dest="dir", default="./") opt, argc = parser.parse_args(argvs) print(argc, opt) display, start_display, add_menu, add_function_to_menu = init_display() axs = gp_Ax3() deg = 30 rad = 0 obj = Geom_ConicalSurface(axs, np.deg2rad(deg), rad) surf = BRepBuilderAPI_MakeFace(obj, -np.pi / 2, np.pi / 2, -100, 100, 1e-6).Face() display.DisplayShape(surf) display.DisplayShape(obj) display.DisplayShape(axs_pln(axs)) display.FitAll() start_display() init = "surf1" surf = ["surf2", "surf3", "surf4"] surf1 = SurfSystem("./", "surf1") surf2 = SurfSystem("./", "surf2") h_surf = BRep_Tool.Surface(surf1.srf) second_derivative(h_surf, 0.5, 0.5) second_derivative(h_surf, 0.5, 0.0) second_derivative(h_surf, 0.0, 0.5) """h_surf = BRep_Tool.Surface(surf2.srf)
return beam_ax, norm_ax, 1 if __name__ == "__main__": argvs = sys.argv parser = OptionParser() parser.add_option("--dir", dest="dir", default="./") opt, argc = parser.parse_args(argvs) print(argc, opt) display, start_display, add_menu, add_function_to_menu = init_display() beam = get_axs("./beam_cyl.cor") surf = set_surface("./cylinder.stp") display.DisplayShape(surf) display.DisplayShape(axs_pln(gp_Ax3())) display.DisplayShape(axs_pln(beam)) axs1 = beam val = 1 while val != None: axs0 = axs1 axs1, axs, val = reflect_axs2(axs0, surf, indx=2) get_deg(axs, dir_to_vec(axs1.Direction())) if val != None: display.DisplayShape(make_line(axs0.Location(), axs1.Location()), color="GREEN") display.DisplayShape(axs_pln(axs1)) display.FitAll()