Message 1 of 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I am trying to create ilogic code in a top level GA which search given file name (which is created by combining string and inventor parameters ) in a given folder (folder exist on a network server and it is not the working directory).
If file exist in the folder then code should replace all instances of a component with that file and if file does not exist then just display a msg that file does not exist and ask user if they would like to do manual assembly of the component. If yes code should stop running and exit. If no code should re-run from start.
Any help is highly appreciated. I am using inventor 2015.
Please see my code below which i have come up with so far but it does not work.
Imports System
Imports System.IO
Imports Inventor
Public Class Bolt
Public Sub Main()
Dim FN As String
FN = "ISO 4014 - " & BOLT_DESIG & "ISO.ipt"
Dim SearchLocation As String = "\\BG-DOC1\am\Vault,D-Comtec\CONTENT CENTRE FILES\en-US\ISO 4014(2)\"
Dim dirs As String
dirs = System.IO.Directory.GetFiles(SearchLocation, FN)
If dirs.Contains(FN) Then
Replace("BR BOLT", "\\BG-DOC1\am\Vault,D-Comtec\CONTENT CENTRE FILES\en-US\ISO 4014(2)\ISO 4014 - " & BOLT_DESIG & "ISO.ipt", True)
Else
MsgBox.Show("The selected bolt size" & FN & "is not available in Meridian\Content Centre Files" _
& vbNewLine & "" _
& vbLf & "Please create a new content centre part file with correct bolt length and re-run the rules OR" _
& vbNewLine & "" _
& vbCrLf & "Manually replace the bolt with desired length.", "Bolt Replacemetn",MsgBoxButtons.OK,MsgBoxIcon.Error)
End If
End Sub
End Class
I am trying to create ilogic code in a top level GA which search given file name (which is created by combining string and inventor parameters ) in a given folder (folder exist on a network server and it is not the working directory).
If file exist in the folder then code should replace all instances of a component with that file and if file does not exist then just display a msg that file does not exist and ask user if they would like to do manual assembly of the component. If yes code should stop running and exit. If no code should re-run from start.
Any help is highly appreciated. I am using inventor 2015.
Please see my code below which i have come up with so far but it does not work.
Imports System
Imports System.IO
Imports Inventor
Public Class Bolt
Public Sub Main()
Dim FN As String
FN = "ISO 4014 - " & BOLT_DESIG & "ISO.ipt"
Dim SearchLocation As String = "\\BG-DOC1\am\Vault,D-Comtec\CONTENT CENTRE FILES\en-US\ISO 4014(2)\"
Dim dirs As String
dirs = System.IO.Directory.GetFiles(SearchLocation, FN)
If dirs.Contains(FN) Then
Replace("BR BOLT", "\\BG-DOC1\am\Vault,D-Comtec\CONTENT CENTRE FILES\en-US\ISO 4014(2)\ISO 4014 - " & BOLT_DESIG & "ISO.ipt", True)
Else
MsgBox.Show("The selected bolt size" & FN & "is not available in Meridian\Content Centre Files" _
& vbNewLine & "" _
& vbLf & "Please create a new content centre part file with correct bolt length and re-run the rules OR" _
& vbNewLine & "" _
& vbCrLf & "Manually replace the bolt with desired length.", "Bolt Replacemetn",MsgBoxButtons.OK,MsgBoxIcon.Error)
End If
End Sub
End Class
Solved! Go to Solution.