Hello,
It is very difficult to give a general mechanism for orienting
properly and semi-automatically the symbols. For the new version,
we have decided to follow another scheme: to draw OpenGL from TCL.
The main disadvantage is that OpenGL is quite difficult to learn
and understand. The main advantage is that it gives complete freedom
to the problemtype creator to draw whatever he/she wants. Another
advantage is that it is easy to copy from someone else the most
standard drawings.
This new possibility should be usable in the last beta version.
As a example, consider the following:
in proc InitGIDProject:
drawopengl registercond DrawSections::drawLoadCond
Global_Beam_Load \
Global_Projected_Beam_Load
And below, you can find the drawing function.
Regards,
--
Compass Ing. y Sistemas Dr. Ramon Ribo
http://www.compassis.com ramsan at compassis.com
c/ Manuel Girona, 61 bajos tel. +34 93 204 10 82
08034 Barcelona, Spain fax. +34 93 204 19 09
-------------------------------------
proc DrawSections::drawLoadCond { condname geommesh num values } {
variable beamcolor
variable load_object
CreateObjects
switch $geommesh {
GEOMETRYUSE {
if { [catch {.central.s info list_entities Lines $num}
list_ent] } { return 0 }
if { [regexp {^\s*STLINE} $list_ent] } {
set type stline
} else { set type nurbline } ;# arc assimilated to nurb
regexp {Points:\s+([0-9]+)\s+([0-9]+)} $list_ent {} P1 P2
foreach j "P1 P2" {
set list_pnt [.central.s info list_entities Points [set
$j]]
regexp {Coord:\s+([^\n]+)} $list_pnt {} coords
set points([set $j]) $coords
}
}
MESHUSE {
if { [lindex [.gid.central.s info Project] 4] == "MESHUSE" }
{
set list_ent [.central.s info list_entities Elements
$num]
set type stline
regexp {([0-9]+)\s+([0-9]+)\s*$} $list_ent {} P1 P2
foreach j "P1 P2" {
set list_pnt [.central.s info list_entities Nodes
[set $j]]
regexp {\S+\s+\S+\s+\S+\s*$} $list_pnt coords
set points([set $j]) $coords
}
} else {
set list_ent [.central.s info list_entities Elements
$num]
set type stline
foreach "P1 P2" [lindex $list_ent 3] break
foreach j "P1 P2" {
set list_pnt [.central.s info list_entities Nodes
[set $j]]
set points([set $j]) [lindex $list_pnt 3]
}
}
}
default { return 0 }
}
switch $condname {
Global_Beam_Load {
set yvec [math::Normalizevector [lrange $values 1 3]]
set color [list .5 0 0]
}
Global_Projected_Beam_Load {
set yvec [math::Normalizevector [lrange $values 1 3]]
set color [list .5 .5 .5]
}
default { return 0 }
}
set delta .1
for { set t $delta } { $t = 1.0+.5*$delta } { set t [expr
{$t+$delta}] } {
if { $type != "stline" } {
set points($P2) [split [.central.s info nurbs line $num 0
$t] ,]
}
set mat [lindex $values 0]
if { [llength $mat] == 1 } {
set mat [math::BeamTransfMatrix [list $P1 $P2] points]
}
set xvec [math::GetAxeInMatrix $mat x]
set mat [math::SetAxeInMatrix $mat y $yvec]
set zvec [math::VectorProd $xvec $yvec]
if { [math::module $zvec] 1e-10 } {
set zvex
- }
set mat [math::SetAxeInMatrix $mat z $zvec]
set length [math::module [math::VectorDiff $points($P1)
$points($P2)]]
drawopengl draw -pushmatrix -translate $points($P1) -multmatrix
\
[math::RotMat2OpenGLmat $mat] -scale [list $length 1 1]
-color $color \
-begin lines -call $load_object -end -popmatrix
if { $type == "stline" } { break }
set points($P1) $points($P2)
}
# return 1 means no draw simbol after
return 1
}
proc DrawSections::CreateObjects {} {
variable ipn_object
variable load_object
if { ![info exists ipn_object] } {
set ipn_object [drawopengl draw -genlists 1]
drawopengl draw -newlist $ipn_object compile \
-normal {0 0 1} \
-vertex {1 1 1} -vertex {0 1 1} -vertex {0 -1 1}
-vertex {1 -1 1} \
-normal {0 -1 0} \
-vertex {1 -1 1} -vertex {0 -1 1} -vertex {0 -1 .9}
-vertex {1 -1 .9} \
-normal {0 0 -1} \
-vertex {1 -1 .9} -vertex {0 -1 .9} -vertex {0 -.1 .9}
-vertex {1 -.1 .9} \
-normal {0 -1 0} \
-vertex {1 -.1 .9} -vertex {0 -.1 .9} -vertex {0 -.1 -.9}
-vertex {1 -.1 -.9} \
-normal {0 0 1} \
-vertex {1 -.1 -.9} -vertex {0 -.1 -.9} -vertex {0 -1 -.9}
-vertex {1 -1 -.9} \
-normal {0 -1 0} \
-vertex {1 -1 -.9} -vertex {0 -1 -.9} -vertex {0 -1 -1}
-vertex {1 -1 -1} \
-normal {0 0 -1} \
-vertex {1 -1 -1} -vertex {0 -1 -1} -vertex {0 1 -1}
-vertex {1 1 -1} \
-normal {0 1 0} \
-vertex {1 1 -1} -vertex {0 1 -1} -vertex {0 1 -.9}
-vertex {1 1 -.9} \
-normal {0 0 1} \
-vertex {1 1 -.9} -vertex {0 1 -.9} -vertex {0 .1 -.9}
-vertex {1 .1 -.9} \
-normal {0 1 0} \
-vertex {1 .1 -.9} -vertex {0 .1 -.9} -vertex {0 .1 .9}
-vertex {1 .1 .9} \
-normal {0 0 -1} \
-vertex {1 .1 .9} -vertex {0 .1 .9} -vertex {0 1 .9}
-vertex {1 1 .9} \
-normal {0 1 0} \
-vertex {1 1 .9} -vertex {0 1 .9} -vertex {0 1 1}
-vertex {1 1 1} \
\
-normal {1 0 0} \
-vertex {0 1 1} -vertex {0 -1 1} -vertex {0 -1 .9}
-vertex {0 1 .9} \
-vertex {0 .1 .9} -vertex {0 -.1 .9} -vertex {0 -.1 -.9}
-vertex {0 .1 -.9} \
-vertex {0 1 -1} -vertex {0 1 -.9} -vertex {0 -1 -.9}
-vertex {0 -1 -1} \
\
-normal {-1 0 0} \
-vertex {1 1 1} -vertex {1 1 .9} -vertex {1 -1 .9}
-vertex {1 -1 1} \
-vertex {1 .1 .9} -vertex {1 .1 -.9} -vertex {1 -.1 -.9}
-vertex {1 -.1 .9} \
-vertex {1 1 -1} -vertex {1 -1 -1} -vertex {1 -1 -.9}
-vertex {1 1 -.9} \
-endlist
}
if { ![info exists load_object] } {
set load_object [drawopengl draw -genlists 1]
set comm "drawopengl draw -newlist $load_object compile "
for { set i 0 } { $i 5 } { incr i } {
set x [expr {$i/4.0}]
append comm "-vertex {$x -1 0} -vertex {$x 0 0} "
append comm "-vertex {[expr {$x-.025}] -.2 0} -vertex {$x 0
0} "
append comm "-vertex {[expr {$x+.025}] -.2 0} -vertex {$x 0
0} "
}
append comm "-vertex {0 -1 0} -vertex {1 -1 0} "
append comm "-endlist"
eval $comm
}
}
-----Mensaje original-----
De: gidlist-admin at gatxan.cimne.upc.es
[mailto:gidlist-admin at gatxan.cimne.upc.es] En nombre de Philippe
Bouchilloux
Enviado el: martes, 10 de junio de 2003 0:07
Para: GiDList
Asunto: [GiDlist] How to orient conditions in *.sim
Hello:
This is what I am doing:
- the user defines a local coordinate system (local_axes)
- the user applies a boundary condition that depends on local_axes to a
set
of volumes present in the model.
The tricky part here is that the boundary condition is radial (for
instance, radial with respect to an axis of local_axes).
To export the data to my solver, there's no problem because I can find
the
orientation of the local_axes in the *.bas file using
LocalAxesDef(EulerAngles), for instance.
However, since local_axes is the same for all the volumes in the set,
then
the drawing of the condition is the same also.
In order to draw properly the condition in GiD, I would need to know the
orientation of local_axes (or the orientation of the element) at the
time
of drawing so that I could apply a formula in the *.sim file that would
properly orient the drawing for each element. I have not found how to
do that.
Is there a way to obtain the local_axes definition (or element
orientation)
for use in the *.sim file?
Thanks.
Philippe
PS: one possible way would seem to add hidden fields (euler angles,
e.g.)
to my condition and automatically compute the value of these fields
based
on the setting of local_axes (using the FUNC command, for instance); but
I
haven't found how to do that either.
Magsoft Corporation
Tel: 518-271-1352
Cell: 518-365-0421 (direct)
www.magsoft-flux.com
_______________________________________________
GiDlist mailing list
GiDlist at gid.cimne.upc.es
http://gid.cimne.upc.es/mailman/listinfo/gidlist