Hi everyone,
I'm working on some vb.net code which updates the sizes of parts within sub assemblies and then selects the correct sub assemblies to place and constrain into a larger assembly.
When I run my software all the sub-assemblies should open, resize and then get placed into the larger assembly.
This code works up to a point. However I'm having some trouble when one of my sub assemblies is placed and constrained into the larger assembly - Inventor crashes.
If I step through my code line by line, it works fine. I think that this is because Inventor has more 'time to think' about what it is doing between placing the sub assembly and constraining it (updating the parts i guess).
After discovering this I wrote a line in my code which uses the vb.net stopwatch class to wait 20 seconds between installing the part and constraining it, this allows everything to work without Inventor crashing.
What I'd like to know is if there is a command i could use in vb.net which would allow me to wait for the sub-assembly to be ready to be constrained rather than waiting 20 seconds? Although this works I don't think it's the 'correct' method of doing things.
I'm using Inventor 2011 SP1.
Any advice would be appreciated.
Thanks
How about calling the UserInterfaceManager.DoEvents just after you place a sub-assembly instead of using stopwatch?
Please let me know if it works for you.