- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have external rules that assist in populating a lot of components and constrains them together. Every time I run the rule, there are certain things I really only need to set once. For example, I don't need to choose the wall thickness, finish, seal types every time. Those are pick lists that I'd like to send the selected values to an external text file and reference the stored values when I run the rule again. Those items are the same for the whole job so no need to repetitively choose the same thing over and over for every time the rule is ran. I only want to select them once and just refer to the stored values. I am not placing these into user parameters as our assembly templates can be used for multiple things, and I don't want finish and seal type as user parameters where they are kind of irrelevant for that particular assembly.
So the thought would be, write common items to a .txt file, then when the rule is ran, it will look for this text file, grab the needed parameters and use them.
I know there is a snippets for writing and reading, but when reading it appears to put it all as 1 string? What would be the best way to
Dim First_Name As String = "first" Dim Last_Name As String = "last" '____Create and write to a text file_________________ oWrite = System.IO.File.CreateText(ThisDoc.PathAndFileName(False) & ".txt") oWrite.WriteLine(First_Name) oWrite.WriteLine(Last_Name) oWrite.Close() 'open the file ThisDoc.Launch(ThisDoc.PathAndFileName(False) & ".txt")
'____Open and read a text file_______________________ oRead = System.IO.File.OpenText(ThisDoc.PathAndFileName(False) & ".txt") EntireFile = oRead.ReadToEnd() oRead.Close() MsgBox(EntireFile, MsgBoxStyle.Information, "Text File Contents")
Solved! Go to Solution.