Jump to content
Sagar Desai

How to get user input in HYPERVIEW

Recommended Posts

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??

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

found how to take input its easy

Quote

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"

 

Share this post


Link to post
Share on other sites

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 ? 

Share this post


Link to post
Share on other sites

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

Pritish Avachat likes this

Share this post


Link to post
Share on other sites
7 hours ago, Pritish Avachat 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 ? 

 

Pritish Avachat likes this

Share this post


Link to post
Share on other sites

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 ! 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
On ‎12‎/‎2‎/‎2016 at 10:49 PM, Sagar Desai 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?

Share this post


Link to post
Share on other sites
On ‎12‎/‎3‎/‎2016 at 5:03 AM, tinh 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?

Share this post


Link to post
Share on other sites
20 hours ago, tinh 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?

Share this post


Link to post
Share on other sites
2 hours ago, tinh 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.

Captu22re.PNG

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...