Pulling my hair out trying to figure out this issue. This is part of a bigger rule but I narrowed it down to this code. From the assembly I am creating a new drawing file using the following code. For troubleshooting purposes the template file is in the same location as the assembly. The issue I am running into is if I open the assembly and run the rule Inventor will lock up and not respond. After restarting Inventor, if I uncomment the messagebox the rule runs just fine. If I comment out the message box again, it still works. The issue comes when I start Inventor for the first time and run the rule with the message box commented out. I've attached a video and dataset. Is there something I'm missing or is this a defect? Any insight would be great!
'create drawing
Dim oDrawingDoc As DrawingDocument
Dim DWGTemplate As String = ThisDoc.Path & "\Drawing Template.idw"
'messagebox.show(1)
oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, DWGTemplate,True)
DanV
Inventor 2014 SP1
Have you installed Update 2 for Inventor 2014 Service Pack 1 ?
http://knowledge.autodesk.com/support/inventor-products/downloads#?rows=10&sort=score
1) It is better to use fully qualified constants - DocumentTypeEnum.kDrawingDocumentObject.
2) Could you please test simplified command to create new drawing document:
oDrawingDoc = ThisApplication.Documents.Add( _
DocumentTypeEnum.kDrawingDocumentObject, Nothing, True)
cheers
I installed Update 2, tried your test code and fully qualified the constants and are still getting the same results. Any other ideas? I just don't get it.
Thanks,
Dan
Vladimir,
Any solution for this? Can you log this in as defect if there's no solution.
Thanks,
Dan
Could you try the following VBA test:
Sub CreateDrawingIssue() Dim oAsmDoc As AssemblyDocument Set oAsmDoc = ThisApplication.ActiveDocument Dim sPath As String sPath = oAsmDoc.FullFileName Dim DWGTemplate As String DWGTemplate = Left(sPath, InStrRev(sPath, "\")) & "\Drawing Template.idw" Debug.Print DWGTemplate Dim oDrawingDoc As DrawingDocument Set oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, DWGTemplate, True) End Sub
This code is equivalent to your rule. Do you get any messages?
Best regards,
This seems to work. Inventor does not lock up if I run this thru VBA. But if I take this code and run it within iLogic, Inventor locks up just like my code. There's something with iLogic.
VBA test gives me the attached warning. This dialog waits for user response. In theory this may effect iLogic code. To check it include Documents.Add method in iLogic rule between SilentOperation = on/off
ThisApplication.SilentOperation = True Dim oDrawingDoc As DrawingDocument Set oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, DWGTemplate, True) ThisApplication.SilentOperation = False
Let me know the result please.
Thanks,
I got that message when I ran it through VBA but I corrected the conflicting styles in the template and re-ran my rules and still are getting the same results. I even ran my rule with no template and still got the same result. As mentioned in the original post, the issue comes when I start Inventor for the first time and run the rule. If a drawing is opened prior to running the rule, it works just fine. What's causing the lockup when the rule is ran after the initial start of Inventor?
Thanks for all your help so far.
Dan