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.TextPrivate Sub MainStartProgram(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 IfIf oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then stringBuilder.AppendLine(String.Join(vbTab, "This is part")) End IfEnd Sub
Žádné komentáře:
Okomentovat