import pylab as p ax = p.axes() fa.formed_object.plot_mpl(ax) p.show() it = bsf_process.init_displ_task animate = False show_init_task = False show_fold_angle_cntl = True fta = FTA(ftv=ftv) fta.init_view(a=33.4389721223, e=61.453898329, d=5.0, f=(1.58015494765, 1.12671403563, -0.111520325399), r=-105.783218753) if show_init_task: ftv.add(it.target_faces[0].viz3d['default']) it.formed_object.viz3d['cp'].set(tube_radius=0.002) ftv.add(it.formed_object.viz3d['cp']) #ftv.add(it.formed_object.viz3d['node_numbers'], order=5) it.u_1 if show_fold_angle_cntl: ft = bsf_process.fold_angle_cntl print 'NDOFS', ft.formed_object.n_dofs print ft.sim_step
p.show() it = bsf_process.init_displ_task animate = False show_init_task = False show_fold_angle_cntl = False show_fold_kinem_cntl = True show_fold_self_weight_cntl = False show_load_self_weight = False fta = FTA(ftv=ftv) fta.init_view(a=33.4389721223, e=61.453898329, d=5.0, f=(1.58015494765, 1.12671403563, -0.111520325399), r=-105.783218753) if show_init_task: ftv.add(it.target_faces[0].viz3d['default']) it.formed_object.viz3d['cp'].set(tube_radius=0.002) ftv.add(it.formed_object.viz3d['cp']) #ftv.add(it.formed_object.viz3d['node_numbers'], order=5) it.u_1 if show_fold_angle_cntl: ft = bsf_process.fold_angle_cntl from oricreate.view import FormingProcessView as FPV
# ft.sim_history.set(anim_t_start=0, anim_t_end=10) # ft.sim_history.viz3d['cp'].set(tube_radius=0.005) # ftv.add(ft.sim_history.viz3d['cp']) fts.sim_history.set(anim_t_start=0, anim_t_end=20) fts.sim_history.viz3d['cp'].set(tube_radius=0.005) ftv.add(fts.sim_history.viz3d['cp']) ftv.plot() ftv.configure_traits() n_cam_move = 20 fta = FTA(ftv=ftv) fta.init_view(a=45.0, e=54.7356103172, d=7.77, f=(0.500000035416, 0.287922133088, 0.409750220151), r=--120.0) fta.add_cam_move(a=24.8592205112, e=35.3839345289, d=4.41536277196, f=(0.500000035416, 0.287922133088, 0.409750220151), r=-93.3680789265, n=n_cam_move, duration=10, vot_start=0.0, vot_end=1.0, azimuth_move='damped', elevation_move='damped',
# ftv.add(ft.config.gu['dofs'].viz3d) # it.u_1 ft.u_1 lt.u_1 # # print 'fu', lt.sim_step.get_f() # print 'Gu', lt.sim_step.get_G() # # cp = lt.formed_object # iL_phi = cp.iL_psi2 - cp.iL_psi_0 # print 'phi', iL_phi ftv.plot() ftv.update(vot=1, force=True) ftv.show() n_cam_move = 100 fta = FTA(ftv=ftv) fta.init_view(a=45, e=60, d=10, f=(0, 0, 0), r=-120) fta.add_cam_move(n=n_cam_move, # a=60, e=70, d=6, r=-120, duration=100, vot_fn=lambda cmt: np.linspace(0.01, 1.0, n_cam_move), azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.plot() fta.render() fta.configure_traits()
}, acc=1e-5, MAX_ITER=10) sim_task = SimulationTask(previous_task=cpf, config=sim_config, n_steps=5) cp = sim_task.formed_object cp.u[cpf.N_grid[(0, -1), 1], 2] = -1.0 sim_task.u_1 ftv = FTV() #ftv.add(sim_task.sim_history.viz3d['node_numbers'], order=5) ftv.add(sim_task.sim_history.viz3d['cp']) ftv.add(gu_dof_constraints.viz3d['default']) fta = FTA(ftv=ftv) fta.init_view(a=200, e=35, d=50, f=(0, 0, 0), r=0) fta.add_cam_move( a=200, e=34, n=5, d=50, r=0, duration=10, # vot_fn=lambda cmt: np.linspace(0, 1, 4), azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.plot() fta.configure_traits()
'psi': gu_psi_constraints}, acc=1e-8, MAX_ITER=200) sim_task = SimulationTask(previous_task=cpf, config=sim_config, n_steps=20) cp = sim_task.formed_object cp.u[cpf.N_grid[::2, :].flatten(), 2] = -0.1 cp.u[cpf.N_grid[0, ::2].flatten(), 2] = -0.2 sim_task.u_1 import pylab as p cp.plot_mpl(p.axes()) p.show() ftv = FTV() # ftv.add(sim_task.sim_history.viz3d['node_numbers'], order=5) ftv.add(sim_task.sim_history.viz3d['cp']) ftv.add(gu_dof_constraints.viz3d['default']) fta = FTA(ftv=ftv) fta.init_view(a=-45, e=65, d=60, f=(0, 0, 0), r=-50) fta.add_cam_move(a=-80, e=80, n=20, d=35, r=-45, duration=10, azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.plot() fta.configure_traits()
sim_config = SimulationConfig(goal_function_type='none', gu={'cl': gu_constant_length, 'u': gu_dof_constraints, 'psi': gu_psi_constraints}, acc=1e-8, MAX_ITER=100) sim_task = SimulationTask(previous_task=cp_factory_task, config=sim_config, n_steps=25) cp.u[(0, 3), 2] = -0.1 cp.u[(1), 2] = 0.1 sim_task.u_1 cp = sim_task.formed_object ftv = FTV() ftv.add(sim_task.sim_history.viz3d_dict['node_numbers'], order=5) ftv.add(sim_task.sim_history.viz3d) ftv.add(gu_dof_constraints.viz3d) fta = FTA(ftv=ftv) fta.init_view(a=200, e=35, d=5, f=(0, 0, 0), r=0) fta.add_cam_move(a=200, e=34, n=5, d=5, r=0, duration=10, vot_fn=lambda cmt: np.linspace(0, 1, 4), azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.plot() fta.render() fta.configure_traits()
ftv.add(ft.sim_history.viz3d['cp']) #ftv.add(it.formed_object.viz3d['node_numbers'], order=5) # ft.config.gu['dofs'].viz3d['default'].scale_factor = 0.5 # ftv.add(ft.config.gu['dofs'].viz3d['default']) ft.u_1 #ftv.plot() #ftv.configure_traits() n_cam_move = 20 fta = FTA(ftv=ftv) fta.init_view(a=45.0, e=54.7356103172, d=7.77, f=(0.500000035416, 0.287922133088, 0.409750220151), r=--120.0) fta.add_cam_move(a=24.8592205112, e=35.3839345289, d=4.41536277196, f=(0.500000035416, 0.287922133088, 0.409750220151), r=-93.3680789265, n=n_cam_move, duration=10, vot_start=0.0, vot_end=1.0, azimuth_move='damped', elevation_move='damped',
fa = bsf_process.factory_task if True: import pylab as p ax = p.axes() fa.formed_object.plot_mpl(ax) p.show() show_fold_angle_cntl = True fta = FTA(ftv=ftv) fta.init_view(a=33.4389721223, e=61.453898329, d=5.0, f=(1.58015494765, 1.12671403563, -0.111520325399), r=-105.783218753) if show_fold_angle_cntl: ft = bsf_process.fold_angle_cntl print('NDOFS', ft.formed_object.n_dofs) print(ft.sim_step) ft.sim_history.set(anim_t_start=0, anim_t_end=10) ft.config.gu['u'].set(anim_t_start=0, anim_t_end=5) ft.sim_history.viz3d['cp'].set(tube_radius=0.002) ftv.add(ft.sim_history.viz3d['cp']) # ftv.add(ft.sim_history.viz3d['node_numbers']) ft.config.gu['u'].viz3d['default'].scale_factor = 0.5 ftv.add(ft.config.gu['u'].viz3d['default'])
ft.sim_history.viz3d['cp'].set(tube_radius=0.002) ftv.add(ft.sim_history.viz3d['cp']) # ftv.add(ft.config.gu['dofs'].viz3d) # it.u_1 ft.u_1 # ftv.plot() # ftv.update(vot=1, force=True) # ftv.show() n_cam_move = 30 fta = FTA(ftv=ftv) fta.init_view(a=60, e=55, d=6, f=(0.85, 0.03, -1.0), r=-132) fta.add_cam_move(a=71, e=78, n=n_cam_move, d=5, r=-120, duration=10, azimuth_move='linear', elevation_move='linear', distance_move='linear', vot_end=0.8) fta.add_cam_move(a=80, e=80, d=5, n=n_cam_move, r=-132, duration=10, azimuth_move='linear', elevation_move='linear', distance_move='linear', vot_start=0.8) fta.plot() fta.configure_traits()
def run_examples(): factor = 10 kw1 = dict(a=0.36, c=0.12, h=0.55, d_r=0.01 / factor, d_up=0.01 / factor, d_down=0.02 / factor, # d_r=0.0005, d_up=0.0005, d_down=0.01, t_max=1.0, n_cell_x=2, n_cell_y=2, n_fold_steps=5 * factor, n_load_steps=1) kw2 = dict(a=2, h=7, c=3, d_r=0.01, d_up=0.01, d_down=0.02, t_max=0.5, n_cell_x=4, n_cell_y=4, n_fold_steps=20, n_load_steps=1) kw3 = dict(a=2, h=3, c=2, d_r=0.01, d_up=0.01, d_down=0.02, t_max=1.0, n_cell_x=1, n_cell_y=1, n_fold_steps=40, n_load_steps=1) kw4 = dict(a=0.36, c=0.18, # 0.17, # 0.12 h=0.4, # 0.4, # 0.55 d_r=0.1 / factor, d_up=0.01 / factor, d_down=0.04 / factor, # d_r=0.01 / factor, d_up=0.01 / factor, d_down=0.04 / factor, # d_r=0.05, d_up=0.005, d_down=0.01, t_max=1.0, psi_max=np.pi, # * 0.99976, n_cell_x=3, n_cell_y=4, # 3, n_fold_steps=60, n_load_steps=1) bsf_process = WBShellFormingProcess(**kw4) ftv = WBShellFormingProcessFTV(model=bsf_process) fa = bsf_process.factory_task if True: import pylab as p fig, ax = p.subplots(1, 1, figsize=(8.27, 11.69), dpi=300) fa.formed_object.plot_mpl(ax, nodes=False, lines=False, facets=False, linewidth=0.2) p.axis('off') N_h_F = fa.N_h[::3, :] N_i_F = fa.N_i[1::3, :] F_lower = np.array( [N_i_F, N_h_F[:-1, :-1], N_h_F[1:, :-1]], dtype=np.float_) F_upper = np.array( [N_i_F, N_h_F[:-1, 1:], N_h_F[1:, 1:]], dtype=np.float_) F_I = np.vstack([F_lower.reshape(3, -1).T, F_upper.reshape(3, -1).T]) L_F_I = F_I[:, [[0, 1], [1, 2], [2, 0]]] p.savefig('/tmp/wb_trr.jpg', bbox_inches=0) it = bsf_process.init_displ_task animate = False show_init_task = False show_fold_angle_cntl = False show_trr = True show_fold_kinem_cntl = False fta = FTA(ftv=ftv, figsize_factor=1.5) fta.init_view(a=33.4389721223, e=61.453898329, d=5.0, f=(1.58015494765, 1.12671403563, -0.111520325399), r=-105.783218753) if show_init_task: ftv.add(it.target_faces[0].viz3d['default']) it.formed_object.viz3d['cp'].trait_set(tube_radius=0.1) ftv.add(it.formed_object.viz3d['cp']) #ftv.add(it.formed_object.viz3d['node_numbers'], order=5) it.u_1 if show_fold_angle_cntl: ft = bsf_process.fold_angle_cntl ft.sim_history.trait_set(anim_t_start=0, anim_t_end=10) # ft.config.gu['dofs'].trait_set(anim_t_start=0, anim_t_end=5) ft.sim_history.viz3d['cp'].trait_set(tube_radius=0.02) print(ft.sim_step) ft.sim_history.set(anim_t_start=0, anim_t_end=10) # ft.config.gu['dofs'].set(anim_t_start=0, anim_t_end=5) ft.sim_history.viz3d['cp'].set(tube_radius=0.002) ftv.add(ft.sim_history.viz3d['cp']) # ftv.add(ft.sim_history.viz3d['node_numbers']) # ft.config.gu['dofs'].viz3d['default'].scale_factor = 0.5 # ftv.add(ft.config.gu['dofs'].viz3d['default']) ft.u_1 # bsf_process.generate_fe_mesh(0.5) fta.add_cam_move(duration=10, n=20) arg_phi, phi = bsf_process.max_slope fig, (ax1, ax3) = p.subplots(2, 1, sharex=True) ax2 = ax1.twinx() n_u, n_v, c = bsf_process.curvature_t ax1.plot(ft.t_arr, c, 'b-', label='curvature') ax2.plot(ft.t_arr, n_u, 'g-', label='height u') ax2.plot(ft.t_arr, n_v, 'y-', label='height v') ax3.plot(ft.t_arr, phi, 'r-', label='slope') # p.show() if show_trr: ft = bsf_process.fold_angle_cntl ft.sim_history.trait_set(anim_t_start=0, anim_t_end=20) ft.sim_history.viz3d['cp'].trait_set(tube_radius=0.005) ftv.add(ft.sim_history.viz3d['cp']) ft.u_1 mt_up = MoveTask(previous_task=ft, u_target=[0, 0, 0.4], rotation_axis=[0, 1, 0], rotation_center=[1, 0, 0], rotation_angle=np.pi / 8, n_steps=30) mt_up.sim_history.trait_set(anim_t_start=20.01, anim_t_end=50) mt_up.sim_history.viz3d['cp'].trait_set(tube_radius=0.005) ftv.add(mt_up.sim_history.viz3d['cp']) mt_up.u_1 mt_fp_down = MoveTask(previous_task=ft, u_target=[0, 0, 0.4], rotation_axis=[0, 1, 0], rotation_center=[1, 0, 0], rotation_angle=0, n_steps=20) mt_fp_down.sim_history.trait_set(anim_t_start=50.01, anim_t_end=70) mt_fp_down.sim_history.viz3d['cp'].trait_set(tube_radius=0.001) ftv.add(mt_fp_down.sim_history.viz3d['cp']) mt_fp_down.u_1 lower_plate_ft = bsf_process.interlock_plate # lower_plate lower_plate_ft.formed_object.viz3d['cp'].trait_set( lines=False, tube_radius=0.001) lower_plate_ft.formed_object.trait_set( anim_t_start=30.0, anim_t_end=50) ftv.add(lower_plate_ft.formed_object.viz3d['cp']) mt_lp_down = MoveTask(previous_task=lower_plate_ft, u_target=[0, 0, 0.4], rotation_axis=[0, 1, 0], rotation_center=[1, 0, 0], rotation_angle=0, n_steps=20) mt_lp_down.sim_history.trait_set(anim_t_start=50.01, anim_t_end=70) mt_lp_down.sim_history.viz3d['cp'].trait_set( lines=False, tube_radius=0.005) ftv.add(mt_lp_down.sim_history.viz3d['cp']) mt_lp_down.u_1 upper_plate_ft = bsf_process.upper_plate upper_plate_ft.formed_object.viz3d['cp'].trait_set( lines=False, tube_radius=0.001) upper_plate_ft.formed_object.trait_set( anim_t_start=50.0, anim_t_end=70) ftv.add(upper_plate_ft.formed_object.viz3d['cp']) # bsf_process.generate_fe_mesh(0.5) fta.init_cam_station.trait_set( azimuth=185, elevation=5., distance=5.34, roll=90.0, focal_point=(1.1, 1.2, 0.0), ) elevation = 77.0 # Turn from crease pattern view to folding position fta.add_cam_move(duration=10, n=30, a=139.71, e=elevation, d=4.26, r=99.5, f=(1.13, 1.17, 0.11), azimuth_move='damped', elevation_move='damped', distance_move='damped', vot_start=0, vot_end=0) # Show the folding process fta.add_cam_move(duration=10, n=60, azimuth_move='damped', elevation_move='damped', distance_move='damped', vot_start=0, vot_end=1) # Wait fta.add_cam_move(duration=1, n=5, vot_start=0, vot_end=0) # Lift the folded plate fta.add_cam_move(duration=9, n=30, a=181, r=90, azimuth_move='damped', roll_move='damped', vot_start=0, vot_end=1) # Wait fta.add_cam_move(duration=1, n=5, vot_start=1, vot_end=1) # Put it down again fta.add_cam_move(duration=9, n=20, vot_start=1, vot_end=0) # Wait fta.add_cam_move(duration=1, n=10, vot_start=0, vot_end=0) # Turn around fta.add_cam_move(duration=9, n=40, e=elevation - 180, f=(0.0, 1.17, 0.5), elevation_move='damped', vot_start=0, vot_end=0) # Wait fta.add_cam_move(duration=1, n=10, vot_start=0, vot_end=0) # Move to the upper plate fta.add_cam_move(duration=9, n=20, vot_start=0, vot_end=1) # Turn it back fta.add_cam_move(duration=4, n=40, e=elevation + 4, d=3.8, elevation_move='damped', distance_move='damped', f=(1.1, 1.1, 0.5), vot_start=1, vot_end=1) # Wait fta.add_cam_move(duration=1, n=10, vot_start=1, vot_end=1) if show_fold_kinem_cntl: ft = bsf_process.fold_kinem_cntl print(ft.sim_step) ft.sim_history.trait_set(anim_t_start=0, anim_t_end=10) ft.config.gu['dofs'].trait_set(anim_t_start=0, anim_t_end=5) ft.sim_history.viz3d['cp'].trait_set(tube_radius=0.002) ftv.add(ft.sim_history.viz3d['cp']) ft.config.gu['dofs'].viz3d['default'].scale_factor = 0.5 ftv.add(ft.config.gu['dofs'].viz3d['default']) ft.u_1 fta.add_cam_move(duration=10, n=20) fta.plot() fta.configure_traits()
def run_examples(): factor = 10 kw4 = dict(a=0.45, # 0.36, c=0.17, # 0.17, # 0.12 h=0.4, # 0.4, # 0.55 d_r=0.1 / factor, d_up=0.01 / factor, d_down=0.04 / factor, # d_r=0.01 / factor, d_up=0.01 / factor, d_down=0.04 / factor, # d_r=0.05, d_up=0.005, d_down=0.01, t_max=1.0, psi_max=np.pi * 0.86, n_cell_x=5, n_cell_y=5, # n_cell_x=3, n_cell_y=3, n_fold_steps=50, n_load_steps=1) bsf_process = WBShellFormingProcess(**kw4) ftv = WBShellFormingProcessFTV(model=bsf_process) it = bsf_process.init_displ_task import pylab as p ax = p.axes() fa = bsf_process.factory_task fa.formed_object.plot_mpl(ax, nodes=False, lines=False, facets=False) p.show() show_init_task = False show_trr = True fta = FTA(ftv=ftv, figsize_factor=1.5) fta.init_view(a=33.4389721223, e=61.453898329, d=6.0, f=(1.58015494765, 1.12671403563, -0.111520325399), r=-105.783218753) if show_init_task: ftv.add(it.target_faces[0].viz3d['default']) it.formed_object.viz3d['cp'].trait_set(tube_radius=0.1) ftv.add(it.formed_object.viz3d['cp']) #ftv.add(it.formed_object.viz3d['node_numbers'], order=5) it.u_1 if show_trr: ft = bsf_process.fold_angle_cntl ft.sim_history.trait_set(anim_t_start=0, anim_t_end=30) ft.sim_history.viz3d['cp'].trait_set(tube_radius=0.005) ftv.add(ft.sim_history.viz3d['cp']) ft.formed_object.viz3d['cp'].trait_set( lines=True, tube_radius=0.005) ft.sim_history.viz3d['cp_thick'].trait_set( lines=False, plane_offsets=[0.006]) ftv.add(ft.sim_history.viz3d['cp_thick']) ft.u_1 lower_plate_ft = bsf_process.interlock_plate # lower_plate lower_plate_ft.formed_object.trait_set( anim_t_start=30.0, anim_t_end=31) lower_plate_ft.formed_object.viz3d['cp'].trait_set( lines=True, tube_radius=0.005) ftv.add(lower_plate_ft.formed_object.viz3d['cp']) lower_plate_ft.formed_object.viz3d['cp_thick'].trait_set( lines=False, plane_offsets=[0.006]) ftv.add(lower_plate_ft.formed_object.viz3d['cp_thick']) ft_center = ft.center_1 ft_center[0] += 0.5 ft_center[1] -= 1.0 ft_rotate = -np.pi / 2 mt_turn = MoveTask(previous_task=ft, u_target=[0, 0, 0], rotation_axis=[0, 0, 1], rotation_center=ft_center, rotation_angle=ft_rotate, n_steps=20) mt_turn.sim_history.trait_set(anim_t_start=30.01, anim_t_end=40) mt_turn.sim_history.viz3d['cp'].trait_set( lines=True, tube_radius=0.005) ftv.add(mt_turn.sim_history.viz3d['cp']) mt_turn.sim_history.viz3d['cp_thick'].trait_set( lines=False, plane_offsets=[0.006]) ftv.add(mt_turn.sim_history.viz3d['cp_thick']) mt_turn.u_1 ft_rotate2 = -np.pi / 3 mt_t2 = MoveTask(previous_task=lower_plate_ft, u_target=[0, 0, 0], rotation_axis=[0, 0, 1], rotation_center=ft_center, rotation_angle=ft_rotate, n_steps=20) mt_t2.sim_history.trait_set(anim_t_start=30.01, anim_t_end=40) mt_t2.sim_history.viz3d['cp'].trait_set( lines=True, tube_radius=0.005) ftv.add(mt_t2.sim_history.viz3d['cp']) mt_t2.sim_history.viz3d['cp_thick'].trait_set( lines=False, plane_offsets=[0.006]) ftv.add(mt_t2.sim_history.viz3d['cp_thick']) mt_t2.u_1 mt_rotate = MoveTask(previous_task=mt_turn, u_target=[0, 0, 0], rotation_axis=[1, 1, 0], rotation_center=ft_center, rotation_angle=ft_rotate2, n_steps=20) mt_rotate.sim_history.trait_set(anim_t_start=40.01, anim_t_end=50) mt_rotate.sim_history.viz3d['cp'].trait_set( lines=True, tube_radius=0.005) ftv.add(mt_rotate.sim_history.viz3d['cp']) mt_rotate.sim_history.viz3d['cp_thick'].trait_set( lines=False, plane_offsets=[0.006]) ftv.add(mt_rotate.sim_history.viz3d['cp_thick']) mt_rotate.u_1 mt_r2 = MoveTask(previous_task=mt_t2, u_target=[0, 0, 0], rotation_axis=[1, 1, 0], rotation_center=ft_center, rotation_angle=ft_rotate2, n_steps=40) mt_r2.sim_history.trait_set(anim_t_start=40.01, anim_t_end=50) mt_r2.sim_history.viz3d['cp'].trait_set( lines=True, tube_radius=0.005) ftv.add(mt_r2.sim_history.viz3d['cp']) mt_r2.sim_history.viz3d['cp_thick'].trait_set( lines=False, plane_offsets=[0.006]) ftv.add(mt_r2.sim_history.viz3d['cp_thick'], name='cp3') mt_r2.u_1 if False: upper_plate_ft = bsf_process.upper_plate upper_plate_ft.formed_object.viz3d['cp'].trait_set( lines=False, tube_radius=0.001) upper_plate_ft.formed_object.trait_set( anim_t_start=50.0, anim_t_end=70) # ftv.add(upper_plate_ft.formed_object.viz3d['cp']) azimuth = 120. elevation = 105 f = it.center_1 f[2] += 1 f[0] += 0.3 fta.init_cam_station.trait_set( azimuth=azimuth, elevation=elevation, distance=7, roll=-115., focal_point=f, ) f[2] -= 1 #f = [1.49, 1.89, 0.45] # Turn from crease pattern view to folding position fta.add_cam_move(duration=10, n=10, # d=6.8, f=f, # ft.center_1, azimuth_move='damped', elevation_move='damped', distance_move='damped', vot_start=0, vot_end=0) # Show the folding process fta.add_cam_move(duration=15, n=60, d=6.8, f=ft.center_1, azimuth_move='damped', elevation_move='damped', distance_move='damped', vot_start=0, vot_end=1) fta.add_cam_move(duration=5, n=20, vot_start=1, vot_end=1) # Wait fta.add_cam_move(duration=1, n=10, vot_start=0, vot_end=0) # Insert the interlocks f = mt_rotate.center_1 fta.add_cam_move(duration=9, n=20, f=f, vot_start=0, vot_end=1) # Wait fta.add_cam_move(duration=1, n=20, vot_start=0, vot_end=0) # Put it down again f = mt_rotate.center_1 f[0] += 0.5 fta.add_cam_move(duration=8, n=40, d=4.0, f=f, distance_move='damped', vot_start=0, vot_end=1) # Wait fta.add_cam_move(duration=1, n=20, vot_start=1, vot_end=1) fta.plot() fta.render()
self.add(vis3d.viz3d) # self.add(self.eft_thick_viz3d) self.add(self.front_viz3d) self.add(self.back_viz3d) # self.add(self.labels_viz3d) # self.add(self.eftlogo_normals) # self.add(self.eftlogo_bases) m = self.mlab super(FoldedStickersFTV, self).plot() oricreate_mlab_label(m) if __name__ == '__main__': twist_folding = TwistFolding(n_steps=40) ftv = FoldedStickersFTV(sim_task=twist_folding) fta = FTA(ftv=ftv) fta.init_view(a=110, e=35, d=11, f=(0, 0, 0), r=160) fta.add_cam_move(a=90, e=10, n=50, d=7, r=180, duration=10, vot_fn=lambda cmt: np.linspace(0, 1, 40), azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.add_cam_move(d=5, n=10, duration=10, vot_fn=lambda cmt: np.ones_like(cmt), azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.add_cam_move(a=0, e=160, d=8, n=25, duration=10, vot_fn=lambda cmt: np.ones_like(cmt),
plt.tight_layout() plt.show() fot = miura_fp.fold_task fot.u_1 lot = miura_fp.load_task lot.u_1 ftv = FTV() lot.sim_history.set(anim_t_start=0, anim_t_end=50) lot.sim_history.viz3d['displ'].set(tube_radius=0.002, warp_scale_factor=5.0) ftv.add(lot.sim_history.viz3d['displ']) gu_dofs_viz3d = lot.config.gu['dofs'].viz3d['default'] gu_dofs_viz3d.scale_factor = 1 ftv.add(gu_dofs_viz3d) ftv.add(lot.config.fu.viz3d['default']) lot.config.fu.viz3d['default'].set(anim_t_start=00, anim_t_end=50) fta = FTA(ftv=ftv) fta.init_view(a=-45, e=65, d=60, f=(0, 0, 0), r=-50) fta.add_cam_move(a=-80, e=80, n=20, d=35, r=-45, duration=10, azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.plot() fta.configure_traits()
ft.sim_history.viz3d['cp'].set(tube_radius=0.002) ftv.add(ft.sim_history.viz3d['cp']) # ftv.add(ft.config.gu['dofs'].viz3d) # it.u_1 ft.u_1 # ftv.plot() # ftv.update(vot=1, force=True) # ftv.show() n_cam_move = 30 fta = FTA(ftv=ftv) fta.init_view(a=60, e=55, d=6, f=(0.85, 0.03, -1.0), r=-132) fta.add_cam_move(a=71, e=78, n=n_cam_move, d=5, r=-120, duration=10, azimuth_move='linear', elevation_move='linear', distance_move='linear', vot_end=0.8) fta.add_cam_move(a=80, e=80, d=5, n=n_cam_move, r=-132,
# self.add(self.eft_thick_viz3d) self.add(self.front_viz3d) self.add(self.back_viz3d) # self.add(self.labels_viz3d) # self.add(self.eftlogo_normals) # self.add(self.eftlogo_bases) m = self.mlab super(FoldedStickersFTV, self).plot() oricreate_mlab_label(m) if __name__ == '__main__': twist_folding = TwistFolding(n_steps=40) ftv = FoldedStickersFTV(sim_task=twist_folding) fta = FTA(ftv=ftv) fta.init_view(a=110, e=35, d=11, f=(0, 0, 0), r=160) fta.add_cam_move(a=90, e=10, n=50, d=7, r=180, duration=10, vot_fn=lambda cmt: np.linspace(0, 1, 40), azimuth_move='damped', elevation_move='damped', distance_move='damped') fta.add_cam_move(d=5, n=10, duration=10, vot_fn=lambda cmt: np.ones_like(cmt), azimuth_move='damped',