displaying

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
Robert EY
Posts: 6
Joined: Thu Jun 22, 2006 3:31 pm

displaying

Post by Robert EY »

I read the discussions about displaying and I still have a few questions.

This is what I found on the discussion board.

# a window showing the displaced shape
recorder display Cantilever 10 10 300 300 -wipe

# next three commmands define viewing system, all values in global coords
vrp 288.0 150.0 0 # point on the view plane in global coord, center of local viewing system
vup 0 1 0 # dirn defining up direction of view plane
vpn 0 0 1 # direction of outward normal to view plane

# next three commands define view, all values in local coord system
prp 0 0 100 # eye location in local coord sys defined by viewing system
viewWindow -400 400 -400 400 # view bounds uMin, uMax, vMin, vMax in local coords
plane 0 150 # distance to front and back clipping planes from eye
projection 0 # projection mode

port -1 1 -1 1 # area of window that will be drawn into
fill 1 # fill mode
display 1 0 10

For vrp is that any point on the view plane?

For prp what is eye location?

for Plane what do you mean by distance to front and back clipping planes?

Lastly for display what are $args?

Thank you, any help would be appreciated.


Also when I source in my file I get a different picture everytime. This is odd because I don't change my file.
silvia
Posts: 3909
Joined: Tue Jan 11, 2005 7:44 am
Location: Degenkolb Engineers
Contact:

Post by silvia »

For vrp is that any point on the view plane?
i can't get this one to work perfectly, pick something to center the plane
For prp what is eye location?
it is a perspective point, are you looking at it from far away or from close?
for Plane what do you mean by distance to front and back clipping planes?
you can clip the objetct you are trying to display (make large numbers if you want to show the entire model)
Lastly for display what are $args?
strange ones, i don't fully understantd them either, here is what I put in the manual:

Code: Select all

set dAmp 10; # this amplification is dependent on the model size

 

if {$ShapeType == "ModeShape" } {

display -$nEigen 0 $dAmp; # display mode shape for mode $nEigen

} elseif {$ShapeType == "NodeNumbers" } {

display 1 -1 0 ; # display node numbers

} elseif {$ShapeType == "DeformedShape" } {

display 1 5 $dAmp; # display deformed shape

}



here is a series of procs I use, hope they help:

Code: Select all

######################################################################################
## procDisplayPlane $ShapeType $dAmp $viewPlane $nEigen $quadrant
######################################################################################
proc procDisplayPlane {ShapeType dAmp viewPlane {nEigen 0}  {quadrant 0}} {
	######################################################################################
	## setup display parameters for specified viewPlane
	######################################################################################
	#### -- by Silvia Mazzoni, 2006 (mazzoni@berkeley_NO_SPAM_.edu)
	####
	#### 	ShapeType : 	type of shape to display. # options: ModeShape , NodeNumbers , DeformedShape 
	#### 	dAmp : 		relative amplification factor for deformations
	#### 	viewPlane :	set local xy axes in global coordinates (XY,YX,XZ,ZX,YZ,ZY)
	#### 	nEigen : 		if nEigen not=0, show mode shape for nEigen eigenvalue
	####	quadrant:		quadrant where to show this figure (0=full figure)
	####	
	######################################################################################

	set Xmin [lindex [nodeBounds] 0];	# view bounds in global coords - proc will add padding on the sides
	set Ymin [lindex [nodeBounds] 1];
	set Zmin [lindex [nodeBounds] 2];
	set Xmax [lindex [nodeBounds] 3];
	set Ymax [lindex [nodeBounds] 4];
	set Zmax [lindex [nodeBounds] 5];

	set Xo 0;	# center of local viewing system
	set Yo 0;
	set Zo 0;

	set uLocal [string index $viewPlane 0];	# viewPlane local-x axis in global coordinates
	set vLocal [string index $viewPlane 1];	# viewPlane local-y axis in global coordinates

	if {$viewPlane =="YZ" } {
		set uMin $Ymin
		set uMax $Ymax
		set vMin $Zmin
		set vMax $Zmax
		set wMin $Xmin
		set wMax $Xmax
	} elseif  {$viewPlane =="ZY" } {
		set uMin $Zmin
		set uMax $Zmax
		set vMin $Ymin
		set vMax $Ymax
		set wMin $Xmin
		set wMax $Xmax
	} elseif  {$viewPlane =="XY"  } {
		set uMin $Xmin
		set uMax $Xmax
		set vMin $Ymin
		set vMax $Ymax
		set wMin $Zmin
		set wMax $Zmax
	} elseif  {$viewPlane =="YX" } {
		set uMin $Ymin
		set uMax $Ymax
		set vMin $Xmin
		set vMax $Xmax
		set wMin $Zmin
		set wMax $Zmax
	} elseif  {$viewPlane =="XZ" } {
		set uMin $Xmin
		set uMax $Xmax
		set vMin $Zmin
		set vMax $Zmax
		set wMin $Ymin
		set wMax $Ymax
	} elseif  {$viewPlane =="ZX" } {
		set uMin $Zmin
		set uMax $Zmax
		set vMin $Xmin
		set vMax $Xmax
		set wMin $Ymin
		set wMax $Ymax
	} elseif  {$viewPlane =="3D" } {
		set uMin $Zmin+$Xmin
		set uMax $Zmax+$Xmax
		set vMin $Ymin
		set vMax $Ymax
		set wMin -10000
		set wMax 10000
		vup 0 1 0; # dirn defining up direction of view plane

	} else {
		return -1
	}

	set epsilon 1e-3;	# make windows width or height not zero when the Max and Min values of a coordinate are the same

	set uWide [expr $uMax - $uMin+$epsilon];
	set vWide [expr $vMax - $vMin+$epsilon];
	set uSide [expr 0.25*$uWide];
	set vSide [expr 0.25*$vWide];
	set uMin [expr $uMin - $uSide];
	set uMax [expr $uMax + $uSide];
	set vMin [expr $vMin - $vSide];
	set vMax [expr $vMax + $vSide];
	set uWide [expr $uMax - $uMin+$epsilon];
	set vWide [expr $vMax - $vMin+$epsilon];
	set uMid [expr ($uMin+$uMax)/2];
	set vMid [expr ($vMin+$vMax)/2];

	# keep the following general, as change the X and Y and Z for each view plane
	# next three commmands define viewing system, all values in global coords
	vrp $Xo $Yo $Zo;    # point on the view plane in global coord, center of local viewing system
	if {$vLocal == "X"} {
		vup 1 0 0; # dirn defining up direction of view plane
	} elseif {$vLocal == "Y"} {
		vup 0 1 0; # dirn defining up direction of view plane
	} elseif {$vLocal == "Z"} {
		vup 0 0 1; # dirn defining up direction of view plane
	}
	if {$viewPlane =="YZ" } {
		vpn 1 0 0; # direction of outward normal to view plane
		prp 10000. $uMid $vMid ; # eye location in local coord sys defined by viewing system
		plane 10000 -10000; # distance to front and back clipping planes from eye
	} elseif  {$viewPlane =="ZY" } {
		vpn -1 0 0; # direction of outward normal to view plane
		prp -10000. $vMid $uMid ; # eye location in local coord sys defined by viewing system
		plane 10000 -10000; # distance to front and back clipping planes from eye
	} elseif  {$viewPlane =="XY"  } {
		vpn 0 0 1; # direction of outward normal to view plane
		prp $uMid $vMid 10000; # eye location in local coord sys defined by viewing system
		plane 10000 -10000; # distance to front and back clipping planes from eye
	} elseif  {$viewPlane =="YX" } {
		vpn 0 0 -1; # direction of outward normal to view plane
		prp $uMid $vMid -10000; # eye location in local coord sys defined by viewing system
		plane 10000 -10000; # distance to front and back clipping planes from eye
	} elseif  {$viewPlane =="XZ" } {
		vpn 0 -1 0; # direction of outward normal to view plane
		prp $uMid -10000 $vMid ; # eye location in local coord sys defined by viewing system
		plane 10000 -10000; # distance to front and back clipping planes from eye
	} elseif  {$viewPlane =="ZX" } {
		vpn 0 1 0; # direction of outward normal to view plane
		prp $uMid 10000 $vMid ; # eye location in local coord sys defined by viewing system
		plane 10000 -10000; # distance to front and back clipping planes from eye
	} elseif  {$viewPlane =="3D" } {
		vpn 1 0.25 1; # direction of outward normal to view plane
		prp -100 $vMid 10000; # eye location in local coord sys defined by viewing system
		plane 10000 -10000; # distance to front and back clipping planes from eye
	}  else {
		return -1
	}
	# next three commands define view, all values in local coord system
	if  {$viewPlane =="3D" } {
		viewWindow [expr $uMin-$uWide/4] [expr $uMax/2] [expr $vMin-0.25*$vWide] [expr $vMax] 
	} else {
		viewWindow $uMin $uMax $vMin $vMax
	}
	projection 1; 	# projection mode, 0:prespective, 1: parallel
	fill 1; 		# fill mode; needed only for solid elements

	if {$quadrant == 0} {
		port -1 1 -1 1 	# area of window that will be drawn into (uMin,uMax,vMin,vMax);
	} elseif {$quadrant == 1} {
		port 0 1 0 1 	# area of window that will be drawn into (uMin,uMax,vMin,vMax);
	} elseif {$quadrant == 2} {
		port -1 0 0 1 	# area of window that will be drawn into (uMin,uMax,vMin,vMax);
	} elseif {$quadrant == 3} {
		port -1 0 -1 0 	# area of window that will be drawn into (uMin,uMax,vMin,vMax);
	} elseif {$quadrant == 4} {
		port 0 1 -1 0 	# area of window that will be drawn into (uMin,uMax,vMin,vMax);
	}

	if {$ShapeType ==  "ModeShape" } {
		display -$nEigen 0  [expr 5.*$dAmp]; 	# display mode shape for mode $nEigen
	} elseif  {$ShapeType ==  "NodeNumbers" } {
		display 1 -1 0  ; 		# display node numbers
	} elseif  {$ShapeType ==  "DeformedShape" }  {
		display 1 5 $dAmp; 		# display deformed shape
	}
};                                                                                                                                                          #
######################################################################################




######################################################################################
## procDisplayShape3D $ShapeType $dAmp $xLoc $yLoc $xPixels $yPixels $nEigen
######################################################################################

proc procDisplayShape3D { ShapeType {dAmp 5}  {xLoc 10} {yLoc 10} {xPixels 750} {yPixels 600} {nEigen 1} } {
	######################################################################################
	## display Node Numbers, Deformed or Mode Shape in all 3 planes
	######################################################################################
	#### -- by Silvia Mazzoni, 2006 (mazzoni@berkeley_NO_SPAM_.edu)
	####
	#### 	ShapeType : 	type of shape to display. # options: ModeShape , NodeNumbers , DeformedShape 
	#### 	dAmp : 		relative amplification factor for deformations
	#### 	xLoc,yLoc  : 	horizontal & vertical location in pixels of graphical window (0,0=upper left-most corner)
	#### 	xPixels,yPixels :	width & height of graphical window in pixels
	#### 	nEigen : 		if nEigen not=0, show mode shape for nEigen eigenvalue
	####	
	#######################################################################################

	global TunitTXT ;	# load global unit variable

	set Xmin [lindex [nodeBounds] 0];	# view bounds in global coords - proc will add padding on the sides
	set Ymin [lindex [nodeBounds] 1];
	set Zmin [lindex [nodeBounds] 2];
	set Xmax [lindex [nodeBounds] 3];
	set Ymax [lindex [nodeBounds] 4];
	set Zmax [lindex [nodeBounds] 5];


	if {$ShapeType ==  "ModeShape" } {
		set lambdaN [eigen $nEigen];		# perform eigenvalue analysis for ModeShape
		set lambda [lindex $lambdaN [expr $nEigen-1]];
		set omega [expr pow($lambda,0.5)]
		set PI 	[expr 2*asin(1.0)];		# define constant
		set Tperiod [expr 2*$PI/$omega];	   	# period
		set fmt1 "Mode Shape, Mode=%.1i Period=%.3f %s  "
		set windowTitle [format $fmt1 $nEigen $Tperiod $TunitTXT ]
	} elseif  {$ShapeType ==  "NodeNumbers" } {
		set windowTitle "Node Numbers"
	} elseif  {$ShapeType ==  "DeformedShape" } {
		set windowTitle0 "Deformed Shape "
	}

	if {$ShapeType ==  "DeformedShape" } {
		set xPixels [expr int($xPixels/2)]
		set yPixels [expr int($yPixels/2)]
		set xLoc1 [expr $xLoc+$xPixels]
		set yLoc1 [expr $yLoc+$yPixels]
		set planeTXT "-Plane"

		set viewPlane XY
		set windowTitle $windowTitle0$viewPlane$planeTXT
		recorder display $windowTitle $xLoc1 $yLoc $xPixels $yPixels  -wipe ; # display recorder
		procDisplayPlane $ShapeType $dAmp $viewPlane 
		set viewPlane ZY
		set windowTitle $windowTitle0$viewPlane$planeTXT
		recorder display $windowTitle $xLoc $yLoc $xPixels $yPixels  -wipe ; # display recorder
		procDisplayPlane $ShapeType $dAmp $viewPlane 
		set viewPlane ZX
		set windowTitle $windowTitle0$viewPlane$planeTXT
		recorder display $windowTitle $xLoc $yLoc1 $xPixels $yPixels  -wipe ; # display recorder
		procDisplayPlane $ShapeType $dAmp $viewPlane 
		set viewPlane 3D
		set windowTitle $windowTitle0$viewPlane
		recorder display $windowTitle $xLoc1 $yLoc1 $xPixels $yPixels  -wipe ; # display recorder
		procDisplayPlane $ShapeType $dAmp $viewPlane 

	} else {

		recorder display $windowTitle $xLoc $yLoc $xPixels $yPixels -nowipe; # display recorder
		set viewPlane XY
		procDisplayPlane $ShapeType $dAmp $viewPlane $nEigen 1
		set viewPlane ZY
		procDisplayPlane $ShapeType $dAmp $viewPlane $nEigen 2
		set viewPlane ZX
		procDisplayPlane $ShapeType $dAmp $viewPlane $nEigen 3
		set viewPlane 3D
		procDisplayPlane $ShapeType $dAmp $viewPlane $nEigen 4
	}

};                                                                                                                                                          #
######################################################################################



######################################################################################
## procDisplayShape2D $ShapeType $dAmp $xLoc $yLoc $xPixels $yPixels $nEigen
######################################################################################
proc procDisplayShape2D { ShapeType {dAmp 5}  {xLoc 10} {yLoc 10} {xPixels 750} {yPixels 600} {nEigen 0} } {
	######################################################################################
	## display Node Numbers, Deformed or Mode Shape in 2D problem
	######################################################################################
	#### -- by Silvia Mazzoni, 2006 (mazzoni@berkeley_NO_SPAM_.edu)
	####
	#### 	ShapeType : 	type of shape to display. # options: ModeShape , NodeNumbers , DeformedShape 
	#### 	dAmp : 		relative amplification factor for deformations
	#### 	xLoc,yLoc  : 	horizontal & vertical location in pixels of graphical window (0,0=upper left-most corner)
	#### 	xPixels,yPixels :	width & height of graphical window in pixels
	#### 	nEigen : 		if nEigen not=0, show mode shape for nEigen eigenvalue
	####	
	#######################################################################################
	global TunitTXT
	set Xmin [lindex [nodeBounds] 0];	# view bounds in global coords - proc will add padding on the sides
	set Ymin [lindex [nodeBounds] 1];
	set Zmin [lindex [nodeBounds] 2];
	set Xmax [lindex [nodeBounds] 3];
	set Ymax [lindex [nodeBounds] 4];
	set Zmax [lindex [nodeBounds] 5];


	if {$ShapeType ==  "ModeShape" } {
		set lambdaN [eigen $nEigen];		# perform eigenvalue analysis for ModeShape
		set lambda [lindex $lambdaN [expr $nEigen-1]];
		set omega [expr pow($lambda,0.5)]
		set PI 	[expr 2*asin(1.0)];		# define constant
		set Tperiod [expr 2*$PI/$omega];	   	# period (sec.) 
		set fmt1 "Mode Shape, Mode=%.1i Period=%.3f %s  "
		set windowTitle [format $fmt1 $nEigen $Tperiod  $TunitTXT]
	} elseif  {$ShapeType ==  "NodeNumbers" } {
		set windowTitle "Node Numbers"
	} elseif  {$ShapeType ==  "DeformedShape" } {
		set windowTitle "Deformed Shape"
	}

	set viewPlane XY
	recorder display $windowTitle $xLoc $yLoc $xPixels $yPixels  -wipe ; # display recorder
	procDisplayPlane $ShapeType $dAmp $viewPlane $nEigen 0
};                                                                                                                                                          #
######################################################################################


######################################################################################
## procDisplayDefaults $dAmp
######################################################################################
proc procDisplayAll { {dAmp 5} } {
	######################################################################################
	## display Node Numbers, Deformed AND Mode Shape using default values.
	######################################################################################
	# view model -- node numbers
	global xPixels;
	global yPixels;
	global xLoc1;
	global yLoc1;
	global xLoc2;
	global yLoc2;
	global xLoc3;
	global yLoc3;

#	set  dAmp 5;	# relative amplification factor for deformations
	set viewEigen 1;	# eigenmode to be viewed
	procDisplayShape2D DeformedShape $dAmp $xLoc1 $yLoc1  $xPixels $yPixels
	procDisplayShape2D NodeNumbers $dAmp $xLoc2 $yLoc2  $xPixels $yPixels
	procDisplayShape2D ModeShape $dAmp $xLoc3 $yLoc3  $xPixels $yPixels  $viewEigen
};                                                                                                                                                          #
######################################################################################

######################################################################################
## procDisplayDefaults $dAmp
######################################################################################
proc procDisplayDefoShape { {dAmp 5} } {
	######################################################################################
	## display Node Numbers, Deformed AND Mode Shape using default values.
	######################################################################################
	# view model -- node numbers
	global xPixels;
	global yPixels;
	global xLoc1;
	global yLoc1;
	global xLoc2;
	global yLoc2;
	global xLoc3;
	global yLoc3;

#	set  dAmp 5;	# relative amplification factor for deformations
	set viewEigen 1;	# eigenmode to be viewed
	procDisplayShape2D DeformedShape $dAmp $xLoc1 $yLoc1  800 600
};                                                                                                                                                          #
######################################################################################
Silvia Mazzoni, PhD
Structural Consultant
Degenkolb Engineers
235 Montgomery Street, Suite 500
San Francisco, CA. 94104
aneeman
Posts: 90
Joined: Thu Jan 12, 2006 1:13 pm
Contact:

vees

Post by aneeman »

There's another vis app you can use if you like. It's available through neesforge, and there's an opensees 1.7.0 win executable with vis inside.

the url:

http://neesforge.nees.org/frs/?group_id ... ease_id=26

you'll also need the glut dll (put it in the same folder as opensees.exe)

http://www.xmission.com/~nate/glut.html

the command is

vees

to show a mesh/frame.

caveat: it's pre-alpha and will shut down opensees when you close the gui.

it uses the keyboard:
x,y,z for rotations, + and - for zoom in and out.

cheers,

alisa
silvia
Posts: 3909
Joined: Tue Jan 11, 2005 7:44 am
Location: Degenkolb Engineers
Contact:

Post by silvia »

but remember that this is version 1.7.0, which does not have many of the new materials of 1.7.2
Silvia Mazzoni, PhD
Structural Consultant
Degenkolb Engineers
235 Montgomery Street, Suite 500
San Francisco, CA. 94104
aneeman
Posts: 90
Joined: Thu Jan 12, 2006 1:13 pm
Contact:

vees

Post by aneeman »

hey, i'll be happy to set up 1.7.2 when the developers' release comes out :)

cheers,
alisa
silvia
Posts: 3909
Joined: Tue Jan 11, 2005 7:44 am
Location: Degenkolb Engineers
Contact:

Post by silvia »

great,
get in touch with Frank, please!
Silvia Mazzoni, PhD
Structural Consultant
Degenkolb Engineers
235 Montgomery Street, Suite 500
San Francisco, CA. 94104
Post Reply