Sometimes it is necessary to retrieve information that arises during the operation of the ilogic code. It is a good idea to keep it in an external file (for example, for future reference to determine the cause of the problem).
Ilogic allows loading standard system functions. For example, creating a text file.
Procedure:
- Import System.Text
- create stringBuilder
- populate stringBuilder
- write stringBuilder to the selected file
Imports System.Text
Private Sub Main
StartProgram(ThisDoc.Document) System.IO.File.WriteAllText("C:\Temp\DocType_Log.txt", stringBuilder.ToString())
End Sub
'----------global variables--------------- Dim stringBuilder As New stringBuilder '------------------------- Private Sub StartProgram(ByVal oDoc As Inventor.Document) If oDoc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then stringBuilder.AppendLine(String.Join(vbTab, "This is assembly")) End If
If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then stringBuilder.AppendLine(String.Join(vbTab, "This is part")) End If
End Sub
Žádné komentáře:
Okomentovat