GiD - The personal pre and post processor

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

See the problemtype <gid>\problemtypes\Examples\customlib\condition_symbols.gid

there is a condition

  <condition n="self_weight_3d" pn="Self weight" ov="volume" ovm="" icon="select" help="Set gravity value giving a Modulus and a Direction" groups_icon="groupCreated">
    <symbol proc="ConditionSymbols::draw_selfweight" orientation="global"/>
    <value n="modulus" pn="Gravity" v="9.81" units="m/s^2" unit_magnitude="Acceleration" help="Gravity acceleration value" string_is="double" icon="data"/>
    <value n="direction" pn="Direction" v="0.0,0.0,-1.0" fieldtype="vector" dimensions="3" help="The resultant unit vector is considered" icon="data"/>
  </condition>

its <symbol> node has attributes

proc="ConditionSymbols::draw_selfweight"

orientation="global"

and the proc is defined as

proc ConditionSymbols::draw_selfweight { values_list } {
    foreach item $values_list {
        lassign $item key value unit
        set data($key) $value
        #set unit($key) $unit
    }
    set modulus $data(modulus)
    set direction [split $data(direction) ,]
    set opposite_direction [math::linearalgebra::scale_vect -1.0 $direction]
    set full_filename [file join [gid_filesystem::get_folder_standard scripts] gid_draw_opengl symbols selfweight.msh]
    set color_lines black
    set color_surfaces blue
    set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh_oriented_z_direction $full_filename $color_lines $color_surfaces $opposite_direction]
    return $list_id
}

the values_list provide the values of each specific condition instance, first are extracted the ones named ‘modulus’ and ‘direction’ and then is called the predefined proc

gid_draw_opengl::create_opengl_list_from_file_mesh_oriented_z_direction

that read the mesh from the path the a mesh file selfweight.msh and draw it with OpenGL commands, creating an drawing list for better performance and return its id

Then creating a model, loading this problemtype, and assigning this condition to a volume, can be drawn for example with the contextual menu: Draw symbols

image-20240125-192121.png

and the shape is drawn oriented with the direction 0,0,-1 (global direction -Z)

image-20240125-191956.png
  • No labels