TCL Force and SPC on local system

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

Hello Everyone !

 

I would like to set up a problem on Hypermesh which include around a hundred load cases (in linear static).

To automate it, I found a TCL which 'allows a simple template to be created to define the loadcases; useful for creating large numbers of static loadcases very quickly and easily' (link)

Thanks to a little VBA, I've just succeed in transforming my Excel data base into a readable txt file for this TCL script. And it works.

 

But my problem is this TCL script only applies my forces (and SPC) on the global system.

Is there a solution, and how can modify the TCL script so that it can apply my load cases on a specific local system (expressed into the .txt for each load cases) ?

 

If someone can help me to takle this problem, I will be sooo grateful :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

(Because I've never learnt how to program in TCL)

 

Thanks in advance,

Best regards,

 

Hervé

 

Unable to find an attachment - read this blog

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited March 2017

    Under HW 14, there's an undocumented command '*loadcreatewithsystemonentity_curve'

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2017

    Under HW 14, there's an undocumented command '*loadcreatewithsystemonentity_curve'

     

    Thanks Q.Nguyen-Dai !

    Do you know how can I use it into this TCL program ?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2017
     Nobody can help me about this topic ? :/
  • tinh
    tinh Altair Community Member
    edited March 2017

    Hi, actually I am not patient enough to read the script in order to modify it.

    If you can clarify your inquires, I may rewrite a sample script :D/emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' title=':D' width='20' />

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2017

    Waouh ! Thank you very much Tinh ! I cross my fingers and hope that you will have time to help me :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

     

    So in a nutshell, I would like to import Excel data (load and boundaries (SPC)) into Hypermesh so that I can set up a stress analysis (with 120 load cases).

    Some of this SPC and FORCE are expressed according to specific local systems.

    The script previously cited works for me but it imports all my data only on the global system and it's not fine for this case (especially for the components of forces).

     

    Thanks again,

    Have a nice day,

    Hervé

     

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited April 2017

    Another possibility: By knowing local systems, on can compute yourself the projections of loads on global system and apply to nodes within your TCL script.

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2017

    Yeah it's a good idea but I didn't select it to facilitate later steps in the project (to keep the same data from beginning to end).

    But if I don't solve it, I will have to use this solution.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2017

    To keep you informed, I furthered the subject by testing the command '*loadcreatewithsystemonentity_curve' that Q.Nguyen-Dai gave to me 4 weeks ago.

    Now the result is quite good since loads can be expressed in the proper local system and not in the global one.

    But because I've never learnt how to program in TCL, I have still some troubles with the automation.

     

    Initial code (create_loadcases.tcl):

    <?xml version="1.0" encoding="UTF-8"?>Initial_Code.thumb.PNG.74a5e1b38db5b6c2c930df6c9f62146a.PNG

     

    I changed the line 757 with the command previously quoted.

    The argument underlined in red is dedicated to the system's ID where my forces will be expressed.

    Modification.PNG.44eaebb3ac174453b28d480bb55c0e19.PNG

    With this syntax hereinabove, all my forces will be created in the '152 Local System'.

    Now, I try to automate this new infomation like the components of my Force ($FX $FY $FZ) so that data can  be collected automatically from the input .txt file.

    wanted_modif.PNG.6dbb90e7b84c7576f168021ed77ec2f6.PNG

     

    Initial txt example file (from 'example1' folder) :

    text_file.PNG.78761bd07b7857fc8cb3ea77a9251978.PNG

     

    Modification: System's ID information:

    text_file_modified.png.2ae0f50ce27ff63b39678f79f46c346b.png

     

    But from now, it doesn't work because some lines have to be added to extract the informations from the txt file and to add it to my ' $id_system '

    Can someone help me to implement this modification ? :(/emoticons/default_sad.png' srcset='/emoticons/sad@2x.png 2x' title=':(' width='20' />

     

    Kind regards,

    Hervé

     

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited April 2017

    Just write a small proc to extract ID-system from TXT file.

    Why use such complicated format in your TXT file?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2017

    Because I found this script that can help me to set up more than 100 load cases easily...

    But if you have a better proposition or idea, I'm ready :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

    Regarding your answer :

    Just write a small proc to extract ID-system from TXT file.

     

    I don't really understand it... Will it be possible to help me a little bit more ? Or even better to modify quickly the program to implement this 'action' ?

     

    Thanks for your help.

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited April 2017

    But without neither your TCL script nor your TXT files, how could I help you?

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2017

    For example by explaining me how to extract ID-system. What is the syntax to do it ? And where to write it in the program...

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited April 2017

    Ahhh, I understand now. You got script from someone and you don't know how to customize.

    If you want to modify structure of config file, you have to adapt TCL too. So if 'FORCE' card is modified, go to 'includes\create_loadcases.tcl' and look for the line

     

     proc ::CreateLoadcase::ReadConfigFile { ConfigFile } {

    Within this proc, you have to modify the code for 'FORCE' card:

     ... 			} elseif { $Card == 'FORCE' } { 				set NodeName [ string trim [ lindex $Data 1 ] ] 				set Factor [ string trim [ lindex $Data 2 ] ]  				set ForceData [ string trim [ lindex $Data 3 ] ] 				set LoadGroup [ string trim [ lindex $Data 4 ] ] 				set FX [ string trim [ lindex $ForceData 0 ] ]  				set FY [ string trim [ lindex $ForceData 1 ] ]  				set FZ [ string trim [ lindex $ForceData 2 ] ]  				lappend FORCE($Index) '{ $NodeName } { $Factor $FX $FY $FZ 1 } { $LoadGroup }' 			} elseif { $Card == 'MOMENT' } { ...

    At the end of this script, you have to insert added data into list to return.

    And so on... :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

    Good luck!