TCL Script doesn't run correctly in Hypermesh

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

Hi,

 

I have written a script in TCL that changes the material properties using an automatic number generator. The script works when I write it into the console, (The interpreter at the bottom of the page, not sure of the correct name). But when I run the script using the run TCL script button nothing happens. I have attached the script. It changes the material properties of a MAT9ORT card. Can someone take a look at my script and give me some advice on how it can be changed to run correctly.

 

I have also attached my hm file for which I am attempting to change the material properties.

 

Kind Regards,

 

Laurence Maskell

Unable to find an attachment - read this blog

Tagged:

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited April 2019

    Hi,

     

    Please remove all return statements, it is not required. 

    return is used to return values when using procedures, in this case it will exit the program. 

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2019

    Hi,

     

    Thank you! I made that alteration and the script is functioning partially correctly. The material properties are changing in accordance with the random number generator, but I get an error saying Error 0. (see attached) When I press ok the material properties are changed but this error message is a problem, how can I remove it?

     

    Kind Regards,

     

    Laurence

    Unable to find an attachment - read this blog

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited April 2019

    Hi,

     

    This error is because there is no component with id 2 in the model.

    *setvalue comps id=2 propertyid={props 1}