Exemplo n.º 1
0
#    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()
Exemplo n.º 2
0
        ft.config.gu['dofs'].viz3d['default'].scale_factor = 0.1
        ftv.add(ft.config.gu['dofs'].viz3d['default'])
        ft.u_1

        fta.add_cam_move(duration=10, n=20)

    if show_load_self_weight:

        lot = bsf_process.load_self_weight
        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)
        lot.sim_history.viz3d['displ'].set(tube_radius=0.002,
                                           )
        ftv.add(lot.sim_history.viz3d['displ'])
        gu_dofs_viz3d = lot.config.gu['dofs'].viz3d['default']
        gu_dofs_viz3d.scale_factor = 0.1
        ftv.add(gu_dofs_viz3d)
        ftv.add(lot.config.fu.viz3d['default'])
        lot.config.fu.viz3d['default'].set(anim_t_start=0, anim_t_end=50)
        ftv.add(lot.config.fu.viz3d['node_load'])
        lot.config.fu.viz3d['node_load'].set(anim_t_start=0, anim_t_end=50)
        u_max = np.max(np.fabs(lot.u_1))
        print(u_max)

        fta.add_cam_move(duration=10, n=20)

    fta.render()
    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()