LS Dyna

LS Dyna

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

Commend to import and export .k file in LS-PrePost

    • longt8
      Subscriber

      Hello, 

      I am considering using script to read and write in .k file into LS-PrePost. I am going to put the script in .bat file and call the function by just clicking it. Would you let me know the sentcence and the website where I can find the instruction? Thank you!

      Teng

    • igandiko
      Ansys Employee

      You can use LSPP command file to run LSPP process in batch mode without launching GUI. First try import and export using GUI. The commands will be saved to lspost.cfile. You can rename this file and call LSPP using below command to run this process without GUI. 

      C:\path\lsprepost410.exe runc=name.cfile

      Please see here (https://lsdyna.ansys.com/knowledge-base/ls-prepost/) for some resources on LSPP. 

    • longt8
      Subscriber

      Hello Imtiaz

      I followed your procedure, but after I clicked my ".bat" file, it just flush one time and my ls prepost is not opened to import the ".k" file.

      This is what I put in my ".bat" file: 

      C:\Program Files\LSTC\LS-PrePost 4.10\lsprepost4.10_x64.exe runc=Import.cfile

      This is what I got in my ".cfile" file:

      open command "C:\.........\Import.cfile"

      Import.cfile is at the same directory with the ".bat" file.

      Would you let me know is the problem?

      Thank you so much.

      Best,

      Teng

       

      • igandiko
        Ansys Employee

        What is your goal in using this .bat file? You said you want to read in .k into LSPP. Does this mean you want the bat file to launch LSPP and open a k file using GUI? The command to launch LSPP and open a k file is simply,

        C:\Program Files\LSTC\LS-PrePost 4.10\lsprepost4.10_x64.exe input.k

        You also said you want the bat file to read and then write a k file. What is being changed when you write this k file? Those changes should be defined in LSPP command file (.cfile). For example, below sample test.cfile will open input.k, translate part 4 by 10 in negative x direction, and then save the file as input_mod.k. The batch command to run this process without GUI access is, 

        "C:\Program Files\LSTC\LS-PrePost 4.10\lsprepost4.10_x64.exe" runc=test.cfile

        Note that path is defined in quotes due to spaces in the path. The contents of test.cfile are

        $-------------------------------------------------------

        openc keyword "input.k"
        genselect node add part 4/0 
        translate_model -10 -0 -0
        translate_model accept 0 1001001 1001001
        transform_model done
        save keywordabsolute 0
        save keywordbylongfmt 0
        save keywordbyi10fmt 0
        save outversion 12
        save keyword "input_mod.k"

        $-------------------------------------------------------

         

         

    • longt8
      Subscriber

       

      Hello Imtiaz,

      I want to automate this process for make it easer for me. Wouldyou let me know how make sure the the LSPP an input and ouput the .k file without error? For some cases, the file has errors but the LSPP still can input or output it. How can I get those information undet the bath mode? 

      Thank you so much.

      Best,

      Teng

       

       

Viewing 3 reply threads
  • The topic ‘Commend to import and export .k file in LS-PrePost’ is closed to new replies.