Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

See how we print the units, we are asking gid GiD for the current active units for the different magnitudes: F for Force, L for LenghtLength, M for Mass

Code Block
languagetcl
customlib::WriteString "Input Data file for Frame3DD - 3D structural frame analysis ([gid_groups_conds::give_active_unit F],[gid_groups_conds::give_active_unit L],[gid_groups_conds::give_active_unit M])"

...

  • Elements assigned to the condition that assigns a material

set condition_name "frameData"
Code Block
set condition_name "frameData"
# If we want this output format "element_id connectivity_x connectivity_y connectivity_z"
set condition_formats [list {"%5d" "element" "id"} {"%5d" "element" "connectivities"}]
# If we want this output format with element id and properties
set condition_formats [list {"%1d" "element" "id"} {"%13.5e" "property" "Ax"} {"%13.5e" "property" "Asy"} ... {"%13.5e" "material" "Density"}]
# To get the number of elements
set formats [customlib::GetElementsFormats $condition_name $condition_formats]
set number_of_elements [GiD_WriteCalculationFile elements -count -elemtype Linear $formats]
# To write the connectivities
customlib::WriteConnectivities $condition_name $formats$condition_formats "" active
  • ContraintsConstraints

This is the way we get the number of nodes assigned to a condition called 'constraints' in the spd.

...

This is the way we access to the data in the tree. Notice that we are building what we call xpath, that is a kind of path in the spd, from the root to the item we want.
Then we get the xml node from the document using selectNodes, and finaly finally we get the current value with get_domnode_attribute

...

In this section, we will write the coordinates, connectivites, and conditions assuming that the input can be different, such as the one in Matfem . In some codes, like matfem, the input file into the solver is not written in a text file, but in a "code like file". The coordinates section in the matfem solver is a matlab array, with a single comma splitting x and y (x, y) and a semicolon spliting splitting a node from another (x1, y1; x2, y2; ...)

...

Code Block
languagetcl
# Point load
    set root [customlib::GetBaseRoot]
    customlib::WriteString ""
    customlib::WriteString "%"
    customlib::WriteString "% Point loads"
    customlib::WriteString "%"
    customlib::WriteString "pointload = \["
    set displacement_fix_nodes [$root selectNodes "*/condition\[@n='PuntualLoads'\]/group"]
    foreach node $displacement_fix_nodes {
        set group [$node @n]
        set val_x [get_domnode_attribute [$node selectNodes "./value\[@n='x-force'\]"] v]
        set val_y [get_domnode_attribute [$node selectNodes "./value\[@n='y-force'\]"] v]
        set fix_x [expr $val_x == 0.0 ? "false" : "true"]
        set fix_y [expr $val_y == 0.0 ? "false" : "true"]
        set nodes [GiD_EntitiesGroups get $group nodes]
        set num_nodes [objarray length $nodes]

        for {set i 0} {$i < $num_nodes} {incr i} {
            set node_id [objarray get $nodes $i]
            if {$i < [expr $num_nodes -1]  } {set end ";"} {set end ""}
            if {$fix_x eq "true" && $fix_y eq "true"} {set end ";" }
            if {$fix_x eq "true"} { customlib::WriteString "$node_id , 1 , $val_x $end" }
            if {$i < [expr $num_nodes -1]  } {set end ";"} {set end ""}
            if {$fix_y eq "true"} { customlib::WriteString "$node_id , 2 , $val_y $end" }
        }
    }
    customlib::WriteString "\] ; "

...