Jump to content
Ms. Haipeng Liu

export result in excel though batch mode

Recommended Posts

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

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

writeTextFile.fdb

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...