<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CSV Filename not working in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3918292#M130894</link>
    <description>Hi Mike&lt;BR /&gt;Yes I think you have a elegant solution here. I will not be able to test it until I get back to work on Monday. I have studied the code and I think the directory structure is not what I am looking for... I didn't explain that in my previous post though&lt;BR /&gt;The csv file is located at C:\Vault\Designs\Project1\Spec_Sheet.csv but the reference part can be in the following locations&lt;BR /&gt;C:\Vault\Designs\Project1\Dir1\ipt or&lt;BR /&gt;C:\Vault\Designs\Project1\Dir1\Dir2\ipt or even further&lt;BR /&gt;So I am trying to track down to find the right project name directory. The only constant here is that from the ipt file path the third directory under C: is the location where the file is located. That is why I split the file name and rebuilt it. But then couldn't use the rebuilt name with StreamReader. I hope I have been able to explain myself. Hope you can help me with this one.&lt;BR /&gt;On a side note I am struggling to get to the help file for iLogic. Can you tell me if any exists? Or suggest a good place to find iLogic command help&lt;BR /&gt;Thank you for your help this far</description>
    <pubDate>Sat, 11 May 2013 10:29:35 GMT</pubDate>
    <dc:creator>VGonsalves</dc:creator>
    <dc:date>2013-05-11T10:29:35Z</dc:date>
    <item>
      <title>CSV Filename not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3916251#M130892</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am trying to write code to collect standard info from a csv file to be added to iProperties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following is the code I have so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim Separators() As Char = {"\"c} Words = ThisDoc.Path.Split(Separators) FilName = "C:\Vault\Designs\" &amp;amp; Words(3) &amp;amp; "\Spec_Sheet.csv"&lt;/P&gt;&lt;P&gt;Dim ReadCSV As New System.IO.StreamReader(FilName) Dim WordSets As New ArrayList()&lt;/P&gt;&lt;P&gt;Do While ReadCSV.Peek &amp;lt;&amp;gt; -1 WordSets.Add(ReadCSV.ReadLine.Split(",")) Loop&lt;/P&gt;&lt;P&gt;i = 0 SName = iProperties.Value("Project", "Stock Number")&lt;/P&gt;&lt;P&gt;For Each wrd In WordSets &amp;nbsp;If WordSets.item(i)(0) = SName Then &amp;nbsp;iProperties.Value("Project", "Description") = WordSets.item(i)(1) &amp;nbsp;iProperties.Value("Custom", "Finish") = WordSets.item(i)(2) &amp;nbsp;End If i += 1 Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only problem I have is that this line crashes. I am not competent enough to understand why. Can anyone help me&lt;!--  StartFragment  --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim ReadCSV As New System.IO.StreamReader(FilName)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  EndFragment  --&gt;Anyone......&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2013 07:20:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3916251#M130892</guid>
      <dc:creator>VGonsalves</dc:creator>
      <dc:date>2013-05-10T07:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Filename not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3916976#M130893</link>
      <description>&lt;P&gt;I think a little error handling could help to solve your problem. Please see the included on a little more eligant way to handle this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;   Private Sub test()
        Dim Thisdoc As Document = ThisAppliocation.ActiveDocument
        Dim FilName As String = GetDirFromPath(Thisdoc.FullDocumentName) &amp;amp; "Spec_Sheet.csv"
        If My.Computer.FileSystem.FileExists(FilName) Then
            Dim WordSets As New ArrayList()
            Using ReadCSV As System.IO.StreamReader = New System.IO.StreamReader(FilName)
                Do While ReadCSV.Peek &amp;lt;&amp;gt; -1
                    WordSets.Add(ReadCSV.ReadLine.Split(","))
                Loop
                ' work with your word sets in this area

            End Using
        Else
            'FilName file did not exist. deal with this in this section or ignor it.
            MsgBox(String.Format("{0} does not exist", FilName), MsgBoxStyle.Information, "Error Reading File")
        End If

    End Sub


    Public Function GetDirFromPath(ByVal path As String) _
      As String

        Try
            Return path.Substring(0, path.LastIndexOf("\") + 1)

        Catch ex As Exception
            ' error
            Return ""
        End Try

    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2013 13:53:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3916976#M130893</guid>
      <dc:creator>Mike.Wohletz</dc:creator>
      <dc:date>2013-05-10T13:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Filename not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3918292#M130894</link>
      <description>Hi Mike&lt;BR /&gt;Yes I think you have a elegant solution here. I will not be able to test it until I get back to work on Monday. I have studied the code and I think the directory structure is not what I am looking for... I didn't explain that in my previous post though&lt;BR /&gt;The csv file is located at C:\Vault\Designs\Project1\Spec_Sheet.csv but the reference part can be in the following locations&lt;BR /&gt;C:\Vault\Designs\Project1\Dir1\ipt or&lt;BR /&gt;C:\Vault\Designs\Project1\Dir1\Dir2\ipt or even further&lt;BR /&gt;So I am trying to track down to find the right project name directory. The only constant here is that from the ipt file path the third directory under C: is the location where the file is located. That is why I split the file name and rebuilt it. But then couldn't use the rebuilt name with StreamReader. I hope I have been able to explain myself. Hope you can help me with this one.&lt;BR /&gt;On a side note I am struggling to get to the help file for iLogic. Can you tell me if any exists? Or suggest a good place to find iLogic command help&lt;BR /&gt;Thank you for your help this far</description>
      <pubDate>Sat, 11 May 2013 10:29:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3918292#M130894</guid>
      <dc:creator>VGonsalves</dc:creator>
      <dc:date>2013-05-11T10:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: CSV Filename not working</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3919452#M130895</link>
      <description>&lt;P&gt;Hi Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have updated my code with your help. It looks like this and works.&lt;!--   StartFragment   --&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt;&lt;SPAN&gt;Separators&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;SPAN&gt;As&lt;/SPAN&gt;&lt;SPAN&gt;Char&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;c&lt;/SPAN&gt;&lt;SPAN&gt;}  &lt;/SPAN&gt;&lt;SPAN&gt;Words&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Path&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Split&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Separators&lt;/S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;(&lt;/SPAN&gt;&lt;SPAN&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;)(&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;End&lt;/SPAN&gt;&lt;SPAN&gt;If&lt;/SPAN&gt;&lt;SPAN&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;+=&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;SPAN&gt;End&lt;/SPAN&gt;&lt;SPAN&gt;Using&lt;/SPAN&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;FilName file did not exist. deal with this in this section or ignor it.&lt;/SPAN&gt;&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;String&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Format&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;{0} does not exist&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;FilName&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;MsgBoxStyle&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Information&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Error Reading File&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;End&lt;/SPAN&gt;&lt;SPAN&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;!--   EndFragment   --&gt;But I am still open to your suggestion of directory handling as outlined in my first reply to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2013 06:00:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/csv-filename-not-working/m-p/3919452#M130895</guid>
      <dc:creator>VGonsalves</dc:creator>
      <dc:date>2013-05-13T06:00:17Z</dc:date>
    </item>
  </channel>
</rss>

