Jump to content

jcd

Members
  • Content Count

    70
  • Joined

  • Last visited


Reputation Activity

  1. tinh liked a post in a topic by jcd in Enabling wrap text in TableView cells   
    @tinh : This is brilliant! Exactly what I was looking to achieve. Thank you so much
  2. jcd liked a post in a topic by Stefano1988 in Creating Constraints   
    Hi JCD
    The size value just means the dimension of the graphic symbol of the constraint (in model units).
     
  3. jcd liked a post in a topic by tinh in HyperMesh Graphics Area freezes after exporting SolverDecks   
    Hi
    did you use command hm_blockredraw somewhere in your script?
    at the end of script you should have "hm_blockredraw 0"
  4. Rahul R liked a post in a topic by jcd in Read hypermesh status updates when Batch Mesher is operational   
    @tinh : This is really useful. However I have one concern, when I configure the message_label to my textvariable, it stops storing the updated messages that should be displayed when the batch mesher is run, instead if I change my variable's value only then is the text in the message_label changed on the hm window.
     
    However, I was able to get the current text in the message_label using,
    .mainFrame.bottom.message_label cget -text   
    Then again, this only gives me the text that is displayed at the time I use this above line, but doesn't keep updating as the text in the label changes.
     
    For example, I want to create a label in my GUI which mirrors the text that is displayed in the message_label always, how could I go about doing that ?
     
    Is there a specific variable that stores the variable in message_label which I can then link my own label's textvariable to ?
     
    Thanks.
  5. tinh liked a post in a topic by jcd in Read hypermesh status updates when Batch Mesher is operational   
    @tinh : This is brilliant! I did think of binding the message_label text itself whenever it is changed, but wasn't able to find any way to do so. However, I never thought that we could bind it to whenever the width of the message_label is changed. This is exactly what I was looking for.
     
    Thank you !
  6. jcd liked a post in a topic by tinh in Read hypermesh status updates when Batch Mesher is operational   
    Hello @jcd
     
    The only way perhaps is to bind .mainFrame.bottom.message_label with a script that will set your variable with its text value
    Think that when message text changed, width of message_label will change, too. It will raise a configure event to which we can bind a script. Example
    #binding: bind .mainFrame.bottom.message_label <Configure> {set your_variable [%W cget -text]} #create your mirrored label: toplevel .your_gui wm transient .your_gui . pack [label .your_gui.label1 -textvariable your_variable]  

  7. jcd liked a post in a topic by tinh in Execute ls command in tkcon from a tcl script   
    actually, ls and dir are procs that invoke tcl command glob. you use glob or define dir proc in your script
  8. jcd liked a post in a topic by tinh in Read hypermesh status updates when Batch Mesher is operational   
    Hi, there is no variable bind to message label, so you need to configure it, example
    .mainframe.bottom.message_label configure -textvariable ::your_var_name
  9. jcd liked a post in a topic by tinh in TK GUI TUTORIAL   
    I tested it and see 2 radio buttons: "Option two" and "Option three"
    an error occurred with rb1 when you creating it, you miss writing it as "rbl" (RBL) !


    regards,
    tinh
  10. jcd liked a post in a topic by tinh in Using *evaltclstring in globalpage.mac with double quotes inside   
    I think I already gave an example using evaltclstring to invoke your user page on utility tab. just refer to it
  11. jcd liked a post in a topic by tinh in Using *evaltclstring in globalpage.mac with double quotes inside   
    Hi,
     
    don't mess up macro file, just wrap the tcl command in a proc, and use *evaltclstring to invoke that proc
  12. jcd liked a post in a topic by tinh in Import tcl script variable into macro   
    Hi @jcd
    it is due to widget stacking order. Please add raise command to the end of p_ShowMyUserPage, to push it up:
    proc p_ShowMyUserPage {Page} {
     #......
        place .frmUserPage -in $frmUserMac -x 0 -y $y
        raise .frmUserPage
    }
  13. jcd liked a post in a topic by tinh in Import tcl script variable into macro   
    No no, jcd
    please remove the line :
    *evaltclstring("source \"C:/sample.tcl\";",0) we don't need this line,
    and what you have to do is create a tcl file named "hmcustom.tcl" and put it in folder .../hm/bin/win64 
    copy codes of proc p_ShowMyUserPage ... and paste into hmcustom.tcl
     
    so that proc will be defined everytime you open hypermesh
     
    comeback to macro file. after remove line *evaltclstring("source .... ", macroSetActivePage will work whenever you click on User button (and also Disp, Geom/Mesh,...) but when you click User button , an argument with value equal 5 will be passed to proc p_ShowMyUserPage
    this proc then simply know that you pressed User button and place a frame with your own buttons on the tab
    if you click Disp, Geom/Mesh,... buttons, the argument value is not equal to 5 and proc p_ShowMyUserPage will remove your buttons from Utility tab 
  14. jcd liked a post in a topic by tinh in Import tcl script variable into macro   
    Hi,
    I see, there is no direct command. but you can do like this:
    - open ...\hm\bin\win64\globalpage.mac to edit
    - looking for macro definition " *beginmacro(macroSetActivePage) ", and add a command inside it:
     
    *beginmacro(macroSetActivePage)
            //Purpose: Sets the active page in the macro meu to passed argument.
           *setactivepage($1)
            //add below command to customize your own page by tcl:
           *evaltclstring("p_ShowMyUserPage $1",0)
    *endmacro()
     
    - define tcl procedure "p_ShowMyUserPage" in a tcl file and source it first
    or define it in ...\hm\bin\win64\hmcustom.tcl (will be sourced whenever opening hm)
    proc p_ShowMyUserPage {Page} {       if {$Page!=5} {catch {place forget .frmUserPage}; return}       if {![winfo exists .frmUserPage]} {           frame .frmUserPage           pack [::ttk::button .frmUserPage.btnDemo -text Demo \                -command {tk_messageBox -message "This is a demo"}]           #add your buttons here\           .....       }       set frmUserMac [winfo children [hm_winfo utilitywindow]]       set y [expr [winfo height $frmUserMac]-200]       place .frmUserPage -in $frmUserMac -x 0 -y $y }  
    - now click Utility>User button, it will invoke p_ShowMyUserPage with Page=5 and show your buttons
  15. jcd liked a post in a topic by tinh in Import tcl script variable into macro   
    Hi,
    variables in tcl script seem to be not available in macro file
    I think you don't need to use macro file, because all of its functions can be (and will be) done by tcl
    example buttongroup, button in macro file => are tk buttons
    macro commands in macro file => are same as hypermesh tcl commands
    you can use tcl script to retrieve / add / remove buttons with your own procs to utility tab
    example
    set frmUtilTab [hm_winfo utilitywindow]
    set frmMacros [winfo children $frmUtilTab]
    set WMgr [winfo manager $frmMacros]
    set WMgrOptions [$WMgr info $frmMacros]
    set frmMyUtils [frame .frmMyUtils]
    pack $frmMyUtils -in $frmUtilTab -fill both -expand 1
    set btnDemo [::ttk::button $frmMyUtils.btnDemo -text Hello -command {tk_messageBox -message "This is a demo"}]
    pack $btnDemo -anchor center
     
    #if you want to restore original utility functions as in macro file:
    pack forget $frmMyUtils
    eval $WMgr
    $WMgrOptions
  16. jcd liked a post in a topic by tinh in Using the *elementtype and *elementsettypes commands   
    Hi,
    did you use  hm_entityinfo  ?
    ex:
    set TypeIDs [hm_entityinfo configtypeids elems quad4]
    set TypeNames [hm_entityinfo configtypes elems quad4]
    foreach TypeID $TypeIDs TypeName $TypeNames {
        puts "Quad4 type $TypeID --> $TypeName"
    }
  17. jcd liked a post in a topic by tinh in Using the *elementtype and *elementsettypes commands   
    Hi,
    you can use hm_entityinfo to find elem type names and ids
  18. jcd liked a post in a topic by tinh in Creating custom layout in a Hyperview Page   
    I think it is impossible 
  19. jcd liked a post in a topic by Q.Nguyen-Dai in Copy component element to new component   
    Try this code:
    *createentity comps cardimage=HM_COMP name=NewComp hm_createmark elems 1 "by comp name" "OldComp" *copymark elements 1 "NewComp"  
  20. jcd liked a post in a topic by Q.Nguyen-Dai in Can't create entityset for a single node without assigning a property to it   
    You can't. Because Hypermesh does not keep "temporary" nodes after   "*nodecleartempmark" command.
    To keep these nodes, you can creat some lines based on these nodes, or some element?
  21. jcd liked a post in a topic by tinh in Can't create entityset for a single node without assigning a property to it   
    That means your script has bug
     
     
    Actually, I don't know how to assign property to a node. If you have problem with your script then show it here. We will debug it easily
  22. jcd liked a post in a topic by Q.Nguyen-Dai in Can't create entityset for a single node without assigning a property to it   
    The following code works for me:
    *createnode 0 0 0 0 0 0 *createmark nodes 1 [hm_latestentityid nodes] *entitysetcreate OneNode nodes 1 *clearmark nodes 1 *createnode 0 0 5 0 0 0 *createmark nodes 1 [hm_latestentityid nodes] *entitysetcreate TwoNode nodes 1 *clearmark nodes 1 *createnode 0 0 10 0 0 0 *createmark nodes 1 [hm_latestentityid nodes] *entitysetcreate ThreeNode nodes 1 *clearmark nodes 1  

  23. jcd liked a post in a topic by tinh in Using the *elementtype and *elementsettypes commands   
    Hi, if a list is not existing, generate it:
    set ListConfigType {}
    foreach Config {tria3 quad4 tetra4 penta6 hex8} {
         set TypeIDs [hm_entityinfo configtypeids elems $Config]
         puts "$Config:\t$TypeIDs"
         dict set ListConfigType $Config $TypeIDs
    }
  24. jcd liked a post in a topic by tinh in Change tk console cursor color   
    Oh, are you consuming your time to fiddle with tkconsole?
    change cursor color:
    .tkcon.tab1 configure -insertbackground red  
  25. Rahul R liked a post in a topic by jcd in Change tk console cursor color   
    Thanks, this is exactly what I was looking for.
     
    Could you refer me to a list of all such functions/options that could be used to configure tkconsole ?
×
×
  • Create New...