Error in Tcl/Tk Macro to create multiple material

kandiyal
kandiyal Altair Community Member
edited October 2020 in Community Q&A

Hi , 
I have created a macro to create multiple material in hypermesh using TCL. 
I am able to create 3 material at a time. but if i try to create more than 3 materials hypermesh throws an error. 
I have attached a TCL code and Error PPT. 

Please help me. 

Thanks, 
Nitin Kandiyal

Unable to find an attachment - read this blog

Answers

  • Pandurang
    Pandurang Altair Community Member
    edited May 2019

    Use this code:

     

    variable  templatefilename [hm_info templatefilename];

    proc createMat {name E G Nu RHO id} \
    {    
        variable templatefilename
        *collectorcreate materials '$name' '' 35
        *createmark materials 1 '$name'
        *dictionaryload materials 1 '$templatefilename' 'MAT1'
        *attributeupdateint materials $id 3240 1 2 0 1
        *attributeupdatedouble materials $id 1 1 0 0 $E
        *attributeupdatedouble materials $id 2 1 0 0 $G
        *attributeupdatedouble materials $id 3 1 0 0 $Nu
        *attributeupdatedouble materials $id 4 1 0 0 $RHO
        *clearmark materials 1;

    }

    createMat Steel 54000 72000 0.36 0.0000000065 1;
    createMat 'Al 2024' 72000 80769.2 0.33 0.00000000785 2;
    createMat 'Al 6065' 54000 72000.2 0.36 0.0000000065 3;
    createMat 'ttl' 34000 71000.2 0.37 0.0000000067 4;