General Mechanical

General Mechanical

Automatically Extract Location of Center of Mass (X, Y, Z)

    • yc2647

      Hi guys, 

      I know that we can get the center of mass for the geometry in Solution Infomation (or in geometry->properties). But I am wondering can we set it as a parameter for parameter optimization? Or automatically return the center of mass? 

      I would like to vary one of the length of my geometry while observing the changes of the center of mass? 

      Would there be any possibilities? 


      Thanks in advacne!

    • Erik Kostson
      Ansys Employee

      Perhaps the *get command (on all elements) can help (have it as a snippet in the results section and that will give parameter named below my_cenx, etc):

      *GET,my_cenx, ELEM, 0,MC, X,
      *GET,my_ceny, ELEM, 0,MC, Y,
      *GET,my_cenz, ELEM, 0,MC, Z,


      Also perhaps ACT can be used and the property 

      CentroidX, Y, Z

      And then create parameters of those.

      All the best




    • yc2647

      Hi Erik, thanks for your reply. I tried to read through MAPDL tutorial, and found this web ( 

      Is there a way that I can extract center of mass "XC", "YC", "ZC" through mapdl.solve()? That is, to extract only the information of XC, YC, ZC? 


      Thank you!

    • Erik Kostson
      Ansys Employee






      That is just in the solve.out.

      Need to use *GET,my_cenx, ELEM, 0,MC, X,

      in pyMAPDL it is:

      mapdl.get('val', 'elem', '', 'MC', 'X')

      for more help on that see:

      get_value — PyMAPDL (

      get — PyMAPDL (


      Thank you





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