Customizing with macros

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

does anyone have any material on the hwt gui interface. I can use hwt to build the dialog boxes, but I can't seem to get my procedure to accept the textvariables (i.e. addentry -textvariable). very painful.

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2008

    John,

    Assuming that you are on windows platform using HW8.0-SR1, you can find documentation using the following path.

    Start -> All Programs -> Altair Hyperworks 8.0sr1 -> Tools -> HW GUI Toolkit

    Here you can find demos and tutorials as well.
  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2008

    Thanks for the reply Pradeep. Sorry it took so long to respond.

    What if I am using HM8SR1 on a unix box?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2008

    Here's an excerpt from the code that is giving me issues:

    set entry1 [ hwt::AddEntry $frame2.entry1 \

    -label 'Cornering:' \

    -font [hwt::AppFont 12 b]\

    -labelWidth $labelWidth \

    -entryWidth $entryWidth \

    -textvariable [namespace current]::entry1TextVariable \

    -validate real \

    -state normal \

    -withoutPacking];

    pack $entry1 -side top -anchor nw;

    proc applycollector {args}

    (some code here)

    *clearmark loadcols 1

    while {$m<=5} {

    set i 1

    while {$i<=$entry1TextVariable} {

    *collectorcreate loadcols 'Corn-$i' '' 8

    *createmark loadcols 1 'Corn_restraint' 'Corn-$i'

    *createmark outputblocks 1

    *createmark groups 1

    *loadstepscreate 'Corn$i' 1

    *attributeupdateint loadsteps $m 4714 1 0 1 0

    *attributeupdateint loadsteps $m 4143 1 0 1 1

    *attributeupdateint loadsteps $m 4709 1 0 1 1

    *attributeupdateentity loadsteps $m 4145 1 0 1 loadcols 1

    eval *attributeupdateentity loadsteps $m 4147 1 0 1 loadcols [expr $i+2]

    incr i

    incr m

    }

    (Some more code here)

    When I go to run the macro, the dialog box comes up, I add the data to the textbox, but when I press the proceed button, I get an error stating the there was no such variable (entry1TextVariable). How can I get the procedure to acknowledge the variable?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2008

    Found the solution. when using the hwt GUI interface, you define the variables in the local (current) namespace. In order to access these variables in a procedure, you need to redefine them in the global namespace. (see below)

    proc someaction {args} {

    global somevariable;

    procedure code

    set i $somevariable

    more code

    ...

    }