Input Mask to choose Elements or Nodes
Hey guys,
I want to create a .tcl-script, that opens an input mask in HyperMesh where the user can select if he wants to mark elements or nodes (e.g. for force or pressure creation). So by clicking on Nodes he should be able to mark the relevant nodes, by clicking on Elements he should be able to mark the relevant elements.
Could you help me out with that problem?
Kind regards
Simon
Answers
-
Not sure if I understand you end goal.
So you have a list of elements/nodes in a file and then you want to mask these entities?
0 -
No, not really.
I'm trying to customize the process of setting up a model. Before actually marking the entities he's interested in, the user should have the possibility to choose if he wants to bring the load on elements (like it is needed for a pressure) or on nodes (like it is needed for a force).
If he wants to mark elements, this part of the code should be active:
*createentity loadcols name=loadcol1
*drawlistresetstyle
*setvalue loadcols id=2 name='Mechanische Belastung'
*createmarkpanel elems 1 'Wählen Sie die Knoten der Belastung aus.'
set mag_val [hm_getfloat 'Belastung =' 'Betrag des Pressure (MPa):' 2000]*pressuresonentity_curve elements 1 1 0 1 0 $mag_val 30 1 0 0 0 0 0
If he wants to mark nodes, this part should be active:
# *setvalue loadcols id=2 name='Mechanische Belastung'
# *startnotehistorystate {Created Force }
# *createmarkpanel nodes 1 'Wählen sie die Knoten der Belastung aus.'
# set mag_val [hm_getfloat 'Belastung =' 'Betrag der Kraft (N):' 300]
# *loadcreateonentity_curve nodes 1 1 1 0 $mag_val 0 0 0 $mag_val 0 0 0 0 0
# *endnotehistorystate {Created Force }I hope this made it a bit clearer.
Thanks in advance,
Simon
0 -
Ok, so basically you want an user input to decide which type of selection must be used.
This can be done in a variety of ways, using simpler forms or the more elegant ones with graphic interface.
Using a simple yes or no question, this would be like so:
set answer [tk_messageBox -message 'What type of load would you like to input? \n Yes: Force \n No: Pressure' -type yesno -icon question] switch -- $answer { yes { 'Code for Force load' } no { 'Code for Pressure load' } }
If you want to have something nicer (which requires more work), you can use for example a radiobutton.
But in this case you need to build the hole interface for the user navigation like confirmation and return buttons and maybe even other options.
A code snippet to use a radiobutton would be like so:
#Get preview frame set w [hwtk::demo::getpreviewframe] set w [hwtk::frame $w.frame] pack $w -anchor nw -padx 4 set ::feedback '' set ::currentLoad 'Force' pack [hwtk::labelframe $w.lf -text 'Select the type of Loading' -padding 2] -anchor nw foreach load {Force Pressure} { pack [hwtk::radiobutton $w.lf.b$load -text $load -variable ::currentLoad \ -value $load \ -command 'set ::feedback $load' \ -help '$load'] -side top -pady 2 -fill x } pack [hwtk::label $w.label -text 'Active Load:'] \ [hwtk::label $w.label1 -textvariable ::feedback] -side left -pady 4
Hopefully this is helpful.
0 -
Thank you so much, this was way more than I expected!
0