I write my code in visual studio then copy and paste it into an ilogic rule. I typically have some cleanup to do on the code once it's in ilogic. For instance ilogic doesn't accept regions and other things. So I started looking for ways where I can paste without cleanup. I can across the ilogic rule setting "Straight VB code". I can't get it working and the documentation written about it doesn't make sense. Can you explain why my code doesn't work?
Imports System Imports System.Type Imports System.Activator Imports SysInter = System.Runtime.InteropServices Imports System.IO Imports Inv = Inventor Module Module1 'By: 'Date: 10/11/19 Public Sub Main() MsgBox("Main") GetDoc() End Sub '=\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/= #Region "Some Sub to Test" Public Sub GetDoc() If ThisDoc.Document.Type = Inv.DocumentTypeEnum.kAssemblyDocumentObject Then MsgBox("Document is an Assembly.") Else If ThisDoc.Document.Type = Inv.DocumentTypeEnum.kDrawingDocumentObject Then MsgBox("Document is an Drawing.") Else If ThisDoc.Document.Type = Inv.DocumentTypeEnum.kPartDocumentObject Then MsgBox("Document is an Drawing.") Else MsgBox("Not a typical document type.") End If End Sub #End Region End Module
Solved! Go to Solution.
Hi, try the following ilogic rule.
Below in comments mode you have the description of the different types of files.
Public Sub Main() MsgBox("Main") GetDoc() End Sub Public Sub GetDoc() Dim doc = ThisDoc.Document If doc.DocumentType = 12291 Then MsgBox("Document is an Assembly.") If doc.DocumentType = 12294 Then MsgBox("Document is a Design Element Document.") If doc.DocumentType = 12292 Then MsgBox("Document is a Drawing Document.") If doc.DocumentType = 12295 Then MsgBox("Document is a Foreign Model Document.") If doc.DocumentType = 12297 Then MsgBox("Document is a No Document.") If doc.DocumentType = 12290 Then MsgBox("Document is a Part Document.") If doc.DocumentType = 12293 Then MsgBox("Document is a Presentation Document.") If doc.DocumentType = 12296 Then MsgBox("Document is a SAT File Document.") If doc.DocumentType = 12289 Then MsgBox("Document is an Unknown Document.") End Sub 'kAssemblyDocumentObject 12291 Assembly Document. 'kDesignElementDocumentObject 12294 Design Element Document. 'kDrawingDocumentObject 12292 Drawing Document. 'kForeignModelDocumentObject 12295 Foreign Model Document. 'kNoDocument 12297 No Document. 'kPartDocumentObject 12290 Part Document. 'kPresentationDocumentObject 12293 Presentation Document. 'kSATFileDocumentObject 12296 SAT File Document. 'kUnknownDocumentObject 12289 Unknown Document.
I hope this helps with your problem, Regards
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn
Can't find what you're looking for? Ask the community or share your knowledge.