Versions Compared

Key

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

...

(the subfolder symbols has some .msh files)

Drawing with orientation global

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

there is a condition

Code Block
languagexml
  <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

Code Block
languagetcl
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

...

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

...

Drawing with orientation local