TCL Script doesn't run correctly in Hypermesh

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

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

Find more posts tagged with

Sort by:
1 - 3 of 31
    User: "llyle_20499"
    New Altair Community Member
    Updated by llyle_20499

    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. 

     

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    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

    User: "llyle_20499"
    New Altair Community Member
    Updated by llyle_20499

    Hi,

     

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

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