LS Dyna

LS Dyna

Topics related to LS-DYNA, Autodyn, Explicit STR and more.

How to modify the SolverTarget of keywords command by script in Workbench

    • 2398629771
      Subscriber

      In Workbench, when adding keywords with Command in LS-DYNA, its SolverTarget property is automatically assigned to LS-DYNA (as shown in Figure 1). 
      However, when using Command to add keywords in LS-DYNA Restart analysis, the SolverTarget property needs to be modified manually (as shown in Figure 2), and this operation is not recorded in the script (as shown in Figure 3). 
      How to modify the SolverTarget property for Command by using the script? 
      In script, the SolverTarget in the AddCommandSnippet () attribute is gets-only.

      Thank very much!!!

    • Deepak
      Ansys Employee

      Hi,Can you try this,
      "command_snippet_57.PropertyByName(“CommandEditorSolverTarget”).InternalValue=3"

       


       

      Thanks,

      Deepak

       

       

    • 2398629771
      Subscriber
    • 2398629771
      Subscriber

      Thank you very muchfor your generous reply. This command is very useful! I can modify the SolverTarget of the command successfully. 

      But after the modification, I have to manually click yes in the pop-up window to execute the subsequent code. Can this operation be controlled by a script? 

      • Deepak
        Ansys Employee

        Hello,

        It might be challenging to interact with pop-up messages directly using a script. However, as a workaround, you can try the following approach:

        analysis24 = DataModel.GetObjectById(24)
        command_snippet = analysis24.AddCommandSnippet()
        command_snippet.Input = ''
        command_snippet.PropertyByName("CommandEditorSolverTarget").InternalValue = 3

        Please give this a try and let me know how it works for you.

        Thanks,

        Deepak

    • 2398629771
      Subscriber

      Thank you again for your timely reply. Your script is very useful. how awesome it is!

      Thank you again for solving the problem that has been bothering me for a long time!

      • Deepak
        Ansys Employee

        You're very welcome! I'm really glad to hear the script was helpful and that it resolved the issue you were facing.
        If you encounter any further challenges with scripting, feel free to reach out through the Home - Community Forum. It's a great place to find support and share ideas.

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