Grasshopper

algorithmic modeling for Rhino

I am working on a custom component that writes strings to a text file, line by line, in order to run simulations in a thid-party analysis program. When the text files are opened in the analysis program, they contain phantom characters that cause the file to be unreadable. Can anyone help with this issue?

 

Thanks!

Views: 493

Replies to This Discussion

What's a phantom character? How are you writing these textfiles?

I have attached a screenshot of the problem. A colleague was attempting to use the text file in the analysis software but saw these strange characters in the file. The program I am creating the file for requires specific formatting, so I am trying to write the file line by line. To write the file, I have used code like the following:

Dim LineCount As Integer      

Dim TextLine(200) As String

TextLine(0) = ("{").Trim()      

TextLine(1) = ("""" + "Project" + """" + ":" + " {").Trim()      

TextLine(2) = ("""" + "FileName" + """" + ":" + " """ + Filename.ToString + ".hcnc" + """" + ",").Trim()

 

And so on for about 100 lines.

Attachments:

I don't pretend to know anything about this subject but it would appear to be a BOM character.

There is a Stackoverflow question about removing it here

 

I have found a VB.net example (http://whatilearnttuday.blogspot.com/2011/10/write-text-files-witho...) and tried the fix they suggest, but the analysis program still will not read it. Is there something different about the way GH components create text files that could be causing this?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service