function input_data()
{
    category("Données de base");
        parameter_int("Nombre de travées",              "n",                       "",   3, UNIT.NONE  , 1,   1,    1000,  true, false);
  
    category("Géométrie");
        parameter_float("Largeur du toit",                "a",                       "",   4, UNIT.LENGTH, 0, 0.1, MAXIMUM, false, false);
        parameter_float("Hauteur des poteaux",           "H_1",          "H<sub>1</sub>",   3, UNIT.LENGTH, 0, 0.1, MAXIMUM, false, false);
        parameter_float("Hauteur du toit",             "H_2",          "H<sub>2</sub>", 0.2, UNIT.LENGTH, 0, 0.1, MAXIMUM, false, false);  
        parameter_float("Longueur de la travée {{number}}",     "L", "L<sub>{{number}}</sub>",   4, UNIT.LENGTH, 0, 0.1, MAXIMUM, false, false, "n");
		
    category("Appuis");
        nodal_support(1, "Appuis bodaux");

    category("Sections");
        section(1, "Poteaux");
        section(2, "Poutres");
        section(3, "Pannes");
}


function generate()
{
    
    //
    // Create structure
    //
  
    var node_count = 4;  // nodes count in one frame
    var line_count = 6;  // lines/members count in one frame + between two frames
 
    // create nodes ((n + 1)*node_count)
    var L = 0;
    for (var i = 0; i < n + 1; i++)
    {
        var n_i = i * node_count;  // index of first node in actual frame
      
        Node(n_i + 0,  -a/2,  L,  -H_1-H_2);
        Node(n_i + 1,     0,  L,  -H_1    );
        Node(n_i + 2,  a/2 ,  L,  -H_1+H_2);
        Node(n_i + 3,     0,  L,         0);

      
        if (i === n)  // to get variable L with value for dimension offset
        {
            break;
        }
          
        L = L + eval("L_" + (i + 1));
    }
  
    // create members
    var member_hinge = MemberHinge(undefined);  // member hinge
	member_hinge.axial_release_n   = Infinity
	member_hinge.axial_release_vy  = Infinity
	member_hinge.axial_release_vz  = Infinity
	member_hinge.moment_release_mt = Infinity
	member_hinge.moment_release_my = 0
	member_hinge.moment_release_mz = 0
  
    var column_params = {"section_start": sections[1]};
    var rafter_params = {"section_start": sections[2]};
    var purlin_params = {"section_start": sections[3]};
  
    var members_counter = 0;
    for (var i = 0; i < n + 1; i++)
    {
        var n_i = i*node_count; // index of first node in actual frame

        if (i > 0)
        {
            var member_0 = Member(members_counter++, [n_i + 0 - node_count, n_i], "", purlin_params);  // purlin
			member_0.member_hinge_start = member_hinge;
			member_0.member_hinge_end = member_hinge;
            
            var member_1 = Member(members_counter++, [n_i + 1 - node_count, n_i + 1], "", purlin_params);  // purlin
            member_1.member_hinge_start = member_hinge;
            member_1.member_hinge_end = member_hinge;
          
            var member_2 = Member(members_counter++, [n_i + 2 - node_count, n_i + 2], "", purlin_params);  // purlin
            member_2.member_hinge_start = member_hinge;
            member_2.member_hinge_end = member_hinge;
        }
      
        Member(members_counter++, [n_i + 1, n_i + 0], "", rafter_params);  // beam
        Member(members_counter++, [n_i + 1, n_i + 2], "", rafter_params);  // beam
        Member(members_counter++, [n_i + 3, n_i + 1], "", column_params);  // column
    }  
  

    // assign supports to nodes
    for (var i = 0; i < n + 1; i++)
    {
        j = i*node_count;
        nodes[3 + j].support = nodal_supports[1];
    }  
  

  
    //
    // Create coordinate systems
    //
  
    // coordinate system for all dimensions
    var coordinate_system_params_1 =
    {
        "origin_coordinates":         [0.000,  0.000,  0.000],
        "u_axis_point_coordinates":   [1    ,  0.000,  0.000],
        "uw_plane_point_coordinates": [0.000,  0.000,  1    ]
    }
    CoordinateSystem(1, model.coordinate_systems.TYPE_3_POINTS, undefined, coordinate_system_params_1);  

  
    //
    // Create dimensions
    //
  
    var linear_dimension_params_1 =
    {
        "linear_coordinate_system": coordinate_systems[1]
    };  
 

    // x dimensions
    LinearDimension(1, nodes[(n + 1)*node_count - 4], nodes[(n + 1)*node_count - 2], "xy", "a", L + 1, "", linear_dimension_params_1);
  
    // y dimensions
    for (i = 1; i < n + 1; i++)
    {  
        j = (i - 1)*node_count;
        LinearDimension(false, nodes[3 + j], nodes[7 + j], "yx", "L" + i.toString().sub(), a/2 + 1, "", linear_dimension_params_1)
    }
     
    // sum dimension y
    if (n > 1)
    {
        LinearDimension(false, nodes[3], nodes[(n + 1)*node_count - 1], "yx", "", a/2 + 2, "", linear_dimension_params_1);
    }   
   
    // z dimensions
    LinearDimension(false, nodes[0], nodes[1], "zx", "H<sub>2</sub>", a/2 + 1, "", linear_dimension_params_1);
    LinearDimension(false, nodes[1], nodes[2], "zx", "H<sub>2</sub>", a/2 + 1, "", linear_dimension_params_1);
    LinearDimension(false, nodes[1], nodes[3], "zx", "H<sub>1</sub>", a/2 + 2, "", linear_dimension_params_1);  
 
}