General Mechanical

General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

APDL Command for Changing Material Properties on Individual Structural Elements

    • 35020306

      Dear all. I am currently working on a model of a cable-stayed bridge as shown above. As part of the modelling process, I would like to simulate sagging effect on the cables by calculating modified elasticity modulus for every cable. I figured I could do it more efficiently by using an APDL command in the analysis. My idea is to create a txt file that is comprised of two columns with the first column comprised of the stay cable ID and the second column comprised of the calculated values of the elasticity modulus. Roughly speaking, the file would look like this:

      Cable ID       |          Modified Elasticity Modulus (MPa)

      EC1              |              174000

      EC2              |              160000

      I would then make named selections of each cable pair (e.g. "EC1", "EC2", etc) in Mechanical. The APDL command script would read the cable ID in the first column, select the appropriate named selection, and then change the elasticity modulus of the elements in the named selection with the values in the second column. So far I've come up with this script but it still doesn't work.

      !Read from files
      AR70 = strpos(STRING_DATA(1,AR80),'')
      ARRAY_DATA(AR80) = valchr(strsub(STRING_DATA(1,AR80),1,AR70))
      AR71 = strleng(STRING_DATA(1,AR80))-AR70+1
      STRING_DATA(1,AR80) = strsub(STRING_DATA(1,AR80),AR70,AR71)
      !Change the Elasticity Modulus

      From the result of the analysis, it seems that the problem is in the last block of code. I couldn't get CMSEL to recognize the stay cable ID which is stored in STRING_DATA. Any help would be appreciated.

    • Ashish Kumar
      Forum Moderator


      Please see if the following link helps: How to change material properties or material assignment in between steps (


      Ashish Kumar

    • Rahul Kumbhar
      Ansys Employee


      Can you check if the first do loop has filled the array successfully?

      • 35020306

        How do you check the content of the array?

Viewing 2 reply threads
  • You must be logged in to reply to this topic.