How to change element id in a saved template (.tpl)
Hi,
I have a saved templete which generates a graph between stress vs strain for a given element id i.e. E181115 (in my case). The graph can be seen in attchments.
#Now i want to change the element id or write a tcl code in such a way that it should ask me to enter the element id before running my template.
I am very new to hyperview and have no idea how to covert .tpl to .tcl,
Any answers, suggestions could be very much helpful.
I am also attching my .tpl file (for understanding)
Thanks in advance
Agassi
Answers
-
Hi,
Native way to modify a text file:
#open that template file:
set fpt [open $TplFilePath r]
#read file and search for elemID
set Content [read -nonewline $fpt]
set Index [string first $elemID $Content]
#replace elemID
close $fpt; set fpt [open $TplFilePath w]
set NewContent [string replace $Content $Index [expr $Index+[string len $elemID]] $NewElemID]
puts $fpt $NewContent
close $fpt
I think tpl functions can help to select elemID. But I can't remember how to do /emoticons/default_sad.png' srcset='/emoticons/sad@2x.png 2x' title=':(' width='20' />
0