🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to get user input in HYPERVIEW

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

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

Find more posts tagged with

Sort by:
1 - 30 of 341
    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi, 

    please search for input box in tklib

    or you can write your own, by dumping tk_dialog, and add an entry on it

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    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?

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi 

    i dont know direct command

    open window command and enter

    tk_dialog

    then enter 

    dump tk_dialog

    it is a sample script

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    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'

     

    User: "tinh"
    Altair Community Member
    Updated by tinh

    yes, it's easy

    if you need input by GUI, view tk_dialog

    User: "Pritish Avachat"
    Altair Community Member
    Updated by Pritish Avachat

    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 ? 

    User: "llyle_20499"
    New Altair Community Member
    Updated by llyle_20499

    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

    User: "tinh"
    Altair Community Member
    Updated by tinh

    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 ? 

     

    User: "Pritish Avachat"
    Altair Community Member
    Updated by Pritish Avachat

    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 ! 

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Please show what the error raised?

    User: "Pritish Avachat"
    Altair Community Member
    Updated by Pritish Avachat

    Please show what the error raised?

    <?xml version="1.0" encoding="UTF-8"?>image.thumb.png.02b6b89fa6c8d84bbc6bc336c81c3992.png

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Please replace '$w' by '.'

    User: "Pritish Avachat"
    Altair Community Member
    Updated by Pritish Avachat

    <?xml version="1.0" encoding="UTF-8"?>image.thumb.png.53069a2e34b27095467f64619cb45af9.png

    User: "tinh"
    Altair Community Member
    Updated by tinh

    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

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

    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?

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

    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?

    User: "tinh"
    Altair Community Member
    Updated by tinh

    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

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

    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?

    User: "tinh"
    Altair Community Member
    Updated by tinh

    I mean a surface that fits with the section. Sorry for my english

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

    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.

    <?xml version="1.0" encoding="UTF-8"?>Captu22re.PNG

    User: "tinh"
    Altair Community Member
    Updated by tinh

    I am searching...

    Plz wait

    User: "tinh"
    Altair Community Member
    Updated by tinh

    I found command 'hb_getresults'

    But you have to pre-select a section

     

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

    I found command 'hb_getresults'

    But you have to pre-select a section

     

    Hi tinh,

    unfortunately its showing hb_getresults as invalid.  

     

    User: "tinh"
    Altair Community Member
    Updated by tinh

    You have to enter hyperbeam GUI first-_-/emoticons/default_sleep.png' srcset='/emoticons/sleep@2x.png 2x' title='-_-' width='20' />

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

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

     

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi

    Try hm_launchhb

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

    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)

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Sure, we have.

    ::HB_Framework::exit -1

    User: "Ajinkya Gaikwad"
    Altair Community Member
    Updated by Ajinkya Gaikwad

    Yes its working successfully..thanks for your help Tinh..

    User: "brahmadev"
    Altair Community Member
    Updated by brahmadev

    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.

1 - 30 of 341