How to get user input in HYPERVIEW
Hello
I want to take some values from user so how can I take values from user
Like in Hypermesh we use hm_getfloat
Is there any command which will serve same purpose in hyperview??
Answers
-
Hi,
please search for input box in tklib
or you can write your own, by dumping tk_dialog, and add an entry on it
0 -
Ok I will search for that
But will direct tcl commands work in hyperview script?
And it will be really helpful if you give any example script you have
And will it pop up window or where we supposed to enter values?
0 -
Hi
i dont know direct command
open window command and enter
tk_dialog
then enter
dump tk_dialog
it is a sample script
0 -
found how to take input its easy
puts 'Enter your name: '
#flush stdout
set name [gets stdin]puts 'Enter your name: '
#flush stdout
set name2 [gets stdin]set sum $name
set sum2 $name2
puts 'Hello $sum'
puts 'Hello $sum2'0 -
yes, it's easy
if you need input by GUI, view tk_dialog
0 -
Code for importing geometry in HM is as follows:
*geomimport 'auto_detect' 'Z:/Users/CAD.stp' 'CleanupTol=-0.01' 'DoNotMergeEdges=off' 'ImportBlanked=off' 'ScaleFactor=1.0'
How can I get these inputs like CAD location, tolerance, scalefactor from user when I run TCL script ?0 -
Hi Pritish,
It will be idea for you to create GUI using TK. You can refer to HW GUI Toolkit
1. From the Start menu, select All Programs.
2. Select Altair HyperWorks.
3. Select Tools.
4. Select HW GUI Toolkit.
You can also refer to the userguide to get started:
https://connect.altair.com/CP/kb-view.html?jf=112968&f=&kb=112938
0 -
Altair Forum User said:
Code for importing geometry in HM is as follows:
set filepath [tk_getOpenFile]set tolerance [hm_getfloat tolerance input]
set scalefactor [hm_getfloat scalefactor input]
*geomimport 'auto_detect' '$filepath' 'CleanupTol=$tolerance' 'DoNotMergeEdges=off' 'ImportBlanked=off' 'ScaleFactor=$scalefactor'
How can I get these inputs like CAD location, tolerance, scalefactor from user when I run TCL script ?0 -
Hello Guys,
Hope you are all doing well ! Your tutoring has helped me a lot in my initial coding.
Now, I am looking to load a tpl file, but before loading I want to take user input for one variable (say span) and use that variable value in formules mentioned in tpl script.
For that I am thinking to have a window pop up before running tpl file, which will store user input value(span) in one variable ($input) and then using this $input in further tpl script.I was able to write this code for poping up window in hypermesh, but this is not working in hyperview when I call same tcl script.
set input [hwtk::inputdialog -text 'Enter Span Value' -inputtype str \
-x [winfo rootx $w] -y [winfo rooty $w]]tk_messageBox -title 'hwtk::inputdialog' -message 'Span: $input mm'
1. CAN you guys help me to pop up a window in Hyperview which will store data in a variable ?
2. How to integrate Tpl script in Tcl to achieve my objective ? or any other way to load the tpl file with Step 1 input in it ?
Awaiting your replies !0 -
Please show what the error raised?
0 -
Altair Forum User said:
Please show what the error raised?
0 -
Please replace '$w' by '.'
0 -
-
Tpl does not share variables with tcl
Suppose sample.tpl is your file
Add these tcl codes to dip $input in sample.tpl
set fpt [open sample.tpl]
set buf [read $fpt]
close $fpt
set buf [string map '\$input \'$input\'' $buf]
set fpt [open sample2.tpl w]
puts $fpt $buf
close $fpt
Now open the sample2.tpl
sample.tpl is reserved
0 -
Altair Forum User said:
Ok I will search for that
But will direct tcl commands work in hyperview script?
And it will be really helpful if you give any example script you have
And will it pop up window or where we supposed to enter values?
HI,
I am trying to get data from hyperbeam Eg. IY,IZ of a solid section. Can you please help me with script or command?
0 -
Altair Forum User said:
Hi
i dont know direct command
open window command and enter
tk_dialog
then enter
dump tk_dialog
it is a sample script
HI,
I am trying to get data from hyperbeam Eg. IY,IZ of a solid section. Can you please help me with script or command?
0 -
I searched its datanames but it does not have IY IZ,
Maybe, you have to create a surface fits with that section , mesh it and use hm_getmoi
0 -
Altair Forum User said:
I searched its datanames but it does not have IY IZ,
Maybe, you have to create a surface fits with that section , mesh it and use hm_getmoi
Hi tinh,
Can you please elaborate the meaning of surface fits?
0 -
I mean a surface that fits with the section. Sorry for my english
0 -
Altair Forum User said:
I mean a surface that fits with the section. Sorry for my english
Hi tinh,
My hypermesh model contains some Hyperbeam sections. Each section will have associated data like shown below,
Area = 777.34677330
Centroid :
Local
Yc = 0.00369492
Zc = 0.00048295
Moments Of Inertia :
Local
IY = 8385.75207149
IZ = 292739.17537076
IYZ = 0.00138714
Centroidal
Iy = 8385.75189018
Iz = 292739.16475806
Iyz = 0.00000000
Principal
Iv = 8385.75189018
Iw = 292739.16475806
Angle = 0.00000000
How can i get this data to text or any readable file by using command because my model has many such beams and I need to extract this details of all the beams.0 -
I am searching...
Plz wait
0 -
I found command 'hb_getresults'
But you have to pre-select a section
0 -
Altair Forum User said:
I found command 'hb_getresults'
But you have to pre-select a section
Hi tinh,
unfortunately its showing hb_getresults as invalid.
0 -
You have to enter hyperbeam GUI first/emoticons/default_sleep.png' srcset='/emoticons/sleep@2x.png 2x' title='-_-' width='20' />
0 -
Altair Forum User said:
You have to enter hyperbeam GUI first
yes tinh, its working now.. thanks a lot...
I would like to know that is there any command to switche to thyperbeam GUI.
If it works then it would be very easy to get the required data.
I am trying with *createmark beamsects 1 'solid_section.0' ,
but its not working..hb_getresults will only work if we switch to hyperbeam gui and select the particular beam section and switch back to model gui...
0 -
Hi
Try hm_launchhb
0 -
Hi Tinh,
Thanks for everything its working successfully....
Just had one doubt.. Do we have any command to get back to hypermesh gui..(unlaunch hyperbeam)
0 -
Sure, we have.
::HB_Framework::exit -1
0 -
Yes its working successfully..thanks for your help Tinh..
0 -
Altair Forum User said:
Sure, we have.
::HB_Framework::exit -1
Hello Tinh,
where did you find this command ?
I have searched it in the reference manual but couldn't find it.
Also, is there a way to directly export all the available shell section data as CSV format through the TCL script?
thanks and regards,
Brahmadev.
0