General Mechanical

General Mechanical

How do I create a ‘for loop’ in ACT console?

    • HAN
      Subscriber

      Hi all,

      I want to create a for loop so that I can load different .igs files automatically, but I couldn't do for loop in ACT console. Does anyone know how to do it?

      Here is my code:

      SetScriptVersion(Version="20.1.164")

      int(num)

      for ( num = 0; num < 2; num++)

      {

        file(num)="D://Solidworks//Ocean buoy//Configuration//test1_20200915_1.igs"

      template1 = GetTemplate(

        TemplateName="Hydrodynamic Diffraction",

        Solver="AQWA")

      system1 = GetSystem(Name="AQW")

      system2 = template1.CreateSystem(

        Position="Right",

        RelativeTo=system1)

      geometry1 = system2.GetContainer(ComponentName="Geometry")

      geometry1.SetFile(FilePath=file(num))

      geometry1.Edit()

      }

    • Aniket
      Ansys Employee
      debugging user scripts does not come under support scope for Ansys employees on learning forum I hope others can chime in here.
      Just to give you hint, Ansys workbench uses ironpython so search "python for loop" to get correct syntax.
      You are not using correct syntax. I hope that helps.
      -Aniket
      How to access Ansys help links
      Guidelines for Posting on Ansys Learning Forum
Viewing 1 reply thread
  • You must be logged in to reply to this topic.