hexagon logo

Can we use Python commands in commands attributes during creating custom dialogue box?

Can we use Python commands in commands attributes during creating custom dialogue box?
Parents
  • Hello I used below python commands after cmd command for dialogue box.
     
    language switch_to python
    import Adams
    import os
    import glob
    def copy_files(source_pattern, destination_file):
    with open(destination_file, 'w') as output_file:
    for filename in glob.glob(source_pattern):
    with open(filename, 'r') as input_file:
    for line in input_file:
    output_file.write(line)
    if __name__ == '__main__':
    source_pattern = 'Run_Angle_*.acf'
    destination_file = 'Simscript_Run.acf'
    copy_files(source_pattern, destination_file)
     
    I used these python command to copy texts from all acf file into one single acf file titled Simscript_Run.acf
     
    but it is not working
     
    If I execute separate python code (not in adams) it copies as expected.
     
    Or if it is possible to create single acf files for multiple runs.
Reply
  • Hello I used below python commands after cmd command for dialogue box.
     
    language switch_to python
    import Adams
    import os
    import glob
    def copy_files(source_pattern, destination_file):
    with open(destination_file, 'w') as output_file:
    for filename in glob.glob(source_pattern):
    with open(filename, 'r') as input_file:
    for line in input_file:
    output_file.write(line)
    if __name__ == '__main__':
    source_pattern = 'Run_Angle_*.acf'
    destination_file = 'Simscript_Run.acf'
    copy_files(source_pattern, destination_file)
     
    I used these python command to copy texts from all acf file into one single acf file titled Simscript_Run.acf
     
    but it is not working
     
    If I execute separate python code (not in adams) it copies as expected.
     
    Or if it is possible to create single acf files for multiple runs.
Children
No Data