Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Crash on Vault Check-in

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
VGonsalves
1144 Views, 11 Replies

iLogic Crash on Vault Check-in

Hi

 

I am trying to run some code prior to checking a file back into vault. The code works when run on a normal File -> Close. But when I check the same file into Vault I experience a crash.

 

Following is the code at its bare minimum and yet it crashes. Can anyone guide me on this one....

'On Error Resume Next
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
Dim Sheet As Inventor.Sheet
Dim Cursheet As String
Cursheet = oDoc.ActiveSheet.Name


For Each oSheet In oDoc.Sheets
oSheet.Activate
For Each pL In oDoc.ActiveSheet.PartsLists
If (pL.Title = "Data Dump List") Then oPartsList = pL

'''Process info'''

Next Next oDoc.Sheets(Cursheet).Activate

 Open to all the ideas.

 

Thank you in advance

Tags (1)
11 REPLIES 11
Message 2 of 12

Could you verify that active document is the document you expect to be active when you experience crash?
use MsgBox:

oDoc = ThisApplication.ActiveDocument
MsgBox(oDoc.FullFilename)

What is the detailed error message you get from iLogic?

 

Thanks,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 12

Hi Vladimir

 

Tried your code but it didn't play nice with iLogic so I changed it to

MessageBox.Show(oDoc.FullFilename, "Title")

I am sure it will give you the same result. But do let me know if you need me to try something else.

 

Now the detailed error is as follows

 

Error Message tab:

Error in rule: Rule1, in document: 15-0002

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

More Info tab:

System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

   at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)

   at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)

   at LmiRuleScript.Main()

   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)

   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

Hope you can help me resolve this one.

 

Thanks

Vishal

Message 4 of 12

Have you set event triggers for your rule?   

Could you describe the workflow in more detail?

Thanks,

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 5 of 12

Yes, I have this code as an external rule in our custom template iDW file and it is set to the 'Close' event trigger.

 

So everytime I close a file I have two scenario's. One when I simply close the file without checking it in and this works just fine. But the second one is where I want to allow checkin which then causes this error.

Message 6 of 12

Could you please itry to ntiate this rule by Before Save event trigger (not Close) and let me know the result.

Thanks.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 7 of 12
VGonsalves
in reply to: VGonsalves

Hi

 

I did move the rule to the save event trigger and added a messagebox to ensure the rule cycles through the sheets. Then I did save the file and checked it into Vault. I did not get any errors, the trigger worked fine.

 

Then I tried reverting back to the original scenario and got the error again. So my rule in combination with a close/check-in event trigger does not work. So the Vault connection seems to play up because if I closed a file which is only in my workspace and not heading to Vault the close trigger works.

 

Do let me know if you need anymore info.

 

Thanks

Message 8 of 12

Another idea

I looks like after iLogic rule the file could be always dirty. That’s why you get an error - check-in won't happen with unsaved document.  


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 9 of 12
VGonsalves
in reply to: VGonsalves

Hi

 

Sorry for the late reply. But I don't understand what you mean by 'dirty' so I tried adding a ThisDoc.Save at the end. That did not help either. I still got a crash on the Close event.

 

Well the code I provdied you does crash and this is with me not processing any of the information I want. The comment '''Process info''' was just to indicate that I will eventually add stuff in there.

 

Could you please try this out on your machine and let me know if it does crash for you too.

 

Do you have any other suggestions to fix this problem?

 

Thanks

Message 10 of 12
adam.nagy
in reply to: VGonsalves

Hi,

 

You said "I am trying to run some code prior to checking a file back into vault."

If you have a look at the discussoin in this thread then it seems like listening to the close event is too late, the file is already checked into Vault by then:

http://forums.autodesk.com/t5/Inventor-Customization/Request-user-interaction-before-save-and-close/...

 

So you as well should probably try to do things in the onsave event.

 

"Dirty" means that the document has unsaved changes. Any change (even oSheet.Activate) will make the document dirty.

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 11 of 12
VGonsalves
in reply to: VGonsalves

Adam

 

Thank you for your reply and the link too. This was highly informative. I will have to work around this issue but now that I know the steps as highlighted in the link I can be smart about it.

 

Thanks once again

Vishal

Message 12 of 12
GosponZ
in reply to: VGonsalves

This rule working perfect. Thank you

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report