Ms. Haipeng Liu 0 Report post Posted August 11, 2017 Hi Caeses Team, I used the batch file to export geometry before. Now I want to export a x value of the point into an excel or text. How could I write this programming command inside the .fsc file? Many thanks! Share this post Link to post Share on other sites
Mr. Carsten Fuetterer 9 Report post Posted August 11, 2017 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 CarstenwriteTextFile.fdb Share this post Link to post Share on other sites
Jörg 29 Report post Posted August 11, 2017 Hi, See also this post for more information about how to write a file. CheersJoerg Share this post Link to post Share on other sites
Ms. Haipeng Liu 0 Report post Posted August 14, 2017 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 CarstenThanks a lot for your advice. It works well in my project. Share this post Link to post Share on other sites
Ms. Haipeng Liu 0 Report post Posted August 14, 2017 Hi, See also this post for more information about how to write a file. CheersJoergHi Joerg, thanks a lot for your sample. It helps a lot! Share this post Link to post Share on other sites
Ms. Haipeng Liu 0 Report post Posted August 14, 2017 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. CheersJoergHi Carsten and Joerg, Is that possible to write the result into an existing excel instead of a new .txt? Share this post Link to post Share on other sites
Jörg 29 Report post Posted September 5, 2017 Hi Haipeng, There is the possibility to connect to an Excel sheet through the COM interface. Maybe this helps. However, I am not sure whether the feature in this rather old post still works, maybe you can simply try it out. Share this post Link to post Share on other sites