3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

IronPython DocumentInsert

    • scdm05
      Subscriber
      ? This post originally contained file attachments which have been removed in compliance with the updated Ansys Learning Forum Terms & Conditions
      Hello I am working on STL file import / SCDM V2020R2
      # Python Script, API Version = V19
      # PATH VARIABLE
      Lattice_Path="C:\temp\Lattices\F"
      #######################################
      Var_Lattices = "1"
      Lattice_Extension=".stl"
      #######################################
      Lattice_Import=Lattice_Path+Var_Lattices+Lattice_Extension
      importOptions = ImportOptions.Create()
      DocumentInsert.Execute(Lattice_Import)
      
      #######################################
      The piece is imported, no problem If I change Var_Lattices to 2 ... it is still ok, F2.stl Loaded   But I am developping for End Users, so I need a User interface
      # Python Script, API Version = V19
      # PATH VARIABLE
      Lattice_Path="C:\temp\Lattices\F"
      #######################################
      Force_Lattice = "None", "1", "2"
      
      def cmd_Import_Lattice():
          if combo_Lattice.Value == "1" :
              MyLattice = "F1.stl"
              importOptions = ImportOptions.Create()
              FileToLoad= str(Lattice_Path+MyLattice)
              DocumentInsert.Execute(FileToLoad)
      
          if combo_Lattice.Value == "2" :
              MyLattice = "F2.stl"
              print MyLattice
      
      combo_Lattice = Beta.InputHelper.CreateComboBox("Force : ","help msg", Force_Lattice)
      button_Lattice_Ini = Beta.InputHelper.CreateButton(cmd_Import_Lattice, ">>> Import", "help msg")
      groupe1 = Beta.InputHelper.CreateOptionsGroup("Ini",combo_Lattice,button_Lattice_Ini)
      result = Beta.InputHelper.PauseAndGetInput ("TITLE, Lattices", groupe1)
      The file 1 from combo is well imported but the script is still running ... so SCDM is not usable anymore, need to kill the process from Task Manager   So any idea are welcome ! Thanks Olivier
    • scdm05
      Subscriber
      # Python Script, API Version = V19
      # PATH VARIABLE
      Lattice_Path="C:\temp\Lattices\"
      #######################################
      Force_Lattice = "None", "1", "2"
      
      def cmd_Import_Lattice():
          if combo_Lattice.Value == "1" :
              MyLattice = "F1.stl"
              importOptions = ImportOptions.Create()
              FileToLoad= str(Lattice_Path+MyLattice)
              DocumentInsert.Execute(FileToLoad)
      
          if combo_Lattice.Value == "2" :
              MyLattice = "F2.stl"
              print MyLattice
      
      combo_Lattice = Beta.InputHelper.CreateComboBox("Force : ","help msg", Force_Lattice)
      button_Lattice_Ini = Beta.InputHelper.CreateButton(cmd_Import_Lattice, ">>> Import", "help msg")
      groupe1 = Beta.InputHelper.CreateOptionsGroup("Ini",combo_Lattice,button_Lattice_Ini)
      result = Beta.InputHelper.PauseAndGetInput ("TITLE, Lattices", groupe1)

      Sorry ... Latice_Path error corrected ... but still looping

    • Subashni Ravichandran
      Forum Moderator

      Hello CFAO Bourjat

      Is this issue resolved? Did the script run or is it still looping?

    • scdm05
      Subscriber

      Hello

      Still looping

Viewing 3 reply threads
  • The topic ‘IronPython DocumentInsert’ is closed to new replies.