General Mechanical

General Mechanical

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

Mechanical Scripting

    • Karan Bhuta
      Subscriber

      I want to select my entire geometry everytime even if I make changes in my spaceclaim. Can I do that?

    • Erik Kostson
      Ansys Employee

      Hi

      Can you explain more what you want to do?

      And why do you need scripting?

      The more info your provide the more feedback you can get from the forum users.

      All the best

      Erik

    • Karan Bhuta
      Subscriber

      I have made a script in spaceclaim that will change the dimensions of my geometry everytime I change a single input according to my requirement. Now I want to do analysis on that geometry using mechanical scripting. Now when I go back to hange my geometry in space claim and update the dimensions there, the selections made in mechanical needs to be made again manually. I want to know if there is a way I can script to make the selection automatically even when I update the geometry.

    • Erik Kostson
      Ansys Employee

      Hi

      One way I use is to scope say loads, etc. to named selections (ns) and not goemetry in Mechanical. In that way it all works.

      To create a named selecton in Spaceclaim as an example of a body (first body in the tree) via script (or one can create the ns manualy inside Spaceclaim):

      selection = BodySelection.Create(GetRootPart().Bodies[0])
      secondarySelection = Selection.Empty()
      resultns = NamedSelection.Create(selection, secondarySelection)

      All the best

      Erik

    • Karan Bhuta
      Subscriber

      Hi ,

      Thank you for that tip it really helped. The face I have selected is kind of the end face and the changes I make in the spaceclaim script changes the end faces' position everytime which results in change in the face number that face. I want to select the end face every time, can I do that?

       

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