I have a form in an assembly which I turn on using a rule with, iLogicForm.Show ("form name") and a trigger to open when file is opened. Works fine.
The problem is when I open the the .idw of the .iam the form comes up. Is there a way to stop the form from opening?
Thanks for the help,
Steve
I'm having the same problem. Did you ever find a solution?
For now, in the drawing (.idw or .dwg), in the Event Trigger dialog box, I unchecked the "Run these rules when events occur" check box. That keeps the form from showing, but then triggers in the drawing don’t work.
@mrattray wrote:
I haven't found a way around this.
My solution is to not use the on open trigger. Instead I use the iTrigger to "manually" load the form. I added the iTrigger command to the marking menu to make it more easily accessible.
I also avoid using the On Open trigger for this reason. I don't think there is a way to stop this currently, because TECHNICALLY, the program is opening the file (even though it's only opening it in the background). It makes more sense to me that the trigger would only apply when the assembly was explictly opened, but that isn't the way it works currently.
Might be a good suggestion to post on the Idea Station. Maybe there are reasons to use it this way, but I can't imagine any cases where the current behavior is actually what I would want.
John's understanding is consistent with my understanding. Indeed, when Inventor opens a drawing file referencing an assembly file, the assembly file is indeed opened in order to keep associativity. So, indeed it is opened.
Thanks!
Hi there,
You could use the following code to check if the rule is started by the assembly or the drawing
If ThisApplication.ActiveDocumentType = kDrawingDocumentObject Then
Then within the if-statement you can decide what to do like stop the code or display a messagebox
Hope this helps,
Martijn van Wijngaarden
Not sure why Autodesk didn't think of a way to prevent that..
Something like an internal flag of "background opened" or just plain "opened"
I had a simmilar problem where I had a rule in my part set to fire whenever there was a change in the part, but this caused issues when changing part in the assembly and I ended up with countless forms popping up.
The way I found around this was to put in an if statement asking tihs document was teh active document.
This way the rules in my parts and subassemblies only fire when I am actuall in them as opposed to changing thing from the assembly above:
------------------------------
Dim myDoc As Document
doc = ThisDoc.Document
myDoc = ThisApplication.ActiveDocument
'this checks if the file with the firing rule is the document you are currently in and using
If doc Is mydoc Then
' your code here
Else
End If
------------------------------------
I Hope this is of some help.
It is possible to stop a part's form from popping up when you open an assembly in which the part exists.
In the part, use the following code (you can safely map it to trigger on an After Document Open event).
If ThisApplication.ActiveDocument Is ThisDoc.Document Then iLogicForm.Show("My Form") End If
It checks to see if the document that is activated (i.e. the assembly) is the same as that running the code. It triggers when you open the part, but not when you open an assembly into which it is placed.
Enjoy!
I used that code as you suggested and works exactly as you mentioned. I added it to the part file and now when I open my assembly the part's form doesn't open. In addition when I open the part, the form appears on a trigger.
However, if I open the part from the assembly, the parts form doesn't automatically appear. I have a form in my assembly that has a button to open a specified part. Upon hitting that button I want the form to appear when the part opens. Not sure what is preventing this from happening as when I open the part from the file explorer for example it works (the form appears off the trigger), but not when I open it from the assembly. Any idea what might be the under lying issue.