Jump to content

Ms. Haipeng Liu

Members
  • Content Count

    6
  • Joined

  • Last visited

Posts posted by Ms. Haipeng Liu


  1. Hi Haipeng,

     

    you have to write a feature inside the project, which writes a file. This can be the code for the feature:

    ffile file(getResultsDir()+"/"+filename)
    if (!file.openWrite())
      echo("Failed to open file \"" + file.getAbsolutePath() + "\" for writing")
      break()
    endif
    
    // use file.write() or file.writeLine() to write to the file.
    
    file.writeLine(""+p:x+"\t"+p:y+"\t"+p:z)
    
    
    //close file when done with it
    file.close()
    
    

    To write this code I simply used the feature templates.

     

    Then in the fsc script you have to write a line:

    exportFile.run()

     

    This will update the feature and trigger the export.

     

    best regards

     

    Carsten

     

     

    Hi,

     

    See also this post for more information about how to write a file.

     

    Cheers

    Joerg

    Hi Carsten and Joerg,

     

    Is that possible to write the result into an existing excel instead of a new .txt?


  2. Hi Haipeng,

     

    you have to write a feature inside the project, which writes a file. This can be the code for the feature:

    ffile file(getResultsDir()+"/"+filename)
    if (!file.openWrite())
      echo("Failed to open file \"" + file.getAbsolutePath() + "\" for writing")
      break()
    endif
    
    // use file.write() or file.writeLine() to write to the file.
    
    file.writeLine(""+p:x+"\t"+p:y+"\t"+p:z)
    
    
    //close file when done with it
    file.close()
    
    

    To write this code I simply used the feature templates.

     

    Then in the fsc script you have to write a line:

    exportFile.run()

     

    This will update the feature and trigger the export.

     

    best regards

     

    Carsten

    Thanks a lot for your advice. It works well in my project. 


  3. Dear Haipeng,

     

    Have you tried to export the hull form, and to close the project and also CAESES after all (as shown in that post you've mentioned)? See this screenshot again: attachicon.gifsweepfsc.png

     

    It seems that the project gets opened, and maybe the value has been set. But in your fsc-file, there is nothing else such as an export or closing CAESES again. Running CAESES in batch mode should be super easy, so maybe there is a problem that I haven't seen yet in your setup?!

     

    Dear Joerg,

     

    Thank you very much for your reply!

     

    I had those export and closing information at the end. Because the input information is long so I didn't show this part in last example. If I run the batch file manually, I don't have any problem in getting the new hullform. The problem is when I link the .fsc file to VBA, batch file stopped before opening the project in CAESES. 

     

    I am eager to link the batch file to ModeFrontier, do you know any other way to do this? 

     

    Thanks a lot for the help in advance!


  4. Hi CAESES Team,

     

    I was trying to use CAESES software as a hullform generator.The parametric model has been generated already. The next step is to link the CAESES with another optimisation software ModeFrontier through Visual Basic Application in Excel.

     

    This is the reference I used:

    https://www.caeses.com/forum/index.php?/topic/284-batch-mode/%3fview=getnewpost

     

    In VBA, "Shell" function is used to run the batch file. But the process stopped before the batch file trying to open CAESES software (I put all the files in a same folder already). 

     

    Image 1: run batch file manually

    Image 2: run batch file through VBA (stopped with this status)

    Image 3: .bat

    Image 4: input (.fsc)

     

    I am wondering, is there any special reference or setting I should add in controlling CAESES automation? 

     

    I got stuck in this problem for a few days. Could someone help me to solve this problem? Thank you very much!

    post-438-0-20585800-1440775407_thumb.jpg

    post-438-0-05383500-1440775412_thumb.jpg

    post-438-0-19425800-1440775529_thumb.jpg

    post-438-0-85359400-1440775531_thumb.jpg

×
×
  • Create New...