×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

getting values after running a macro

getting values after running a macro

getting values after running a macro

(OP)
I am trying to run and macro within a macro. Say main macro is -- macro_main and the internal macro -- macro_sub

I am passing a variable (ux) from macro_main to macro_sub as macro_sub,ux

Now, I am doing some computations inside macro_sub and would like to retain the modified value of ux in macro_sub once it returns to macro_main.

Kindly do tell me method how I can do it??

Ansys by default reverts back to original value after it excutes macro_sub and comes to macro_main. I would like to write a macro something like the *get or *set commands. is this possible?? I want to know if yes, can I increase it to more than one variable??

In short is there a concept of pass by 'pass by address' rather than 'pass by value'?? (in terms of progamming jargon  c++ or Java). do remember that I cannot write 'ux' inside macro_sub as its a very generalised macro - like a function.

Only solution I can think of as of now ...

save the parameter in a file using parsav and read using parres?? any pointers will be highly appreciated.

Thanks

RE: getting values after running a macro

I guess there is no direct solution to this, you can open a command file and write the parameter there and read it back from the main macro, second option is to save the parameters by parsav and resume it in the main model by parres. But this may have some unwanted consequences (i.e. overwriting the parameters in the main macro).

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources