Adding Drawing Views or Occurances Crashing Inventor?

Adding Drawing Views or Occurances Crashing Inventor?

Anonymous
Not applicable
385 Views
1 Reply
Message 1 of 2

Adding Drawing Views or Occurances Crashing Inventor?

Anonymous
Not applicable

Hello Everyone,

 

I wanted to post this out there for people who may be running into crashing issues when adding occurances to an assembly or drawing views.

 

After struggling for several hours I noticed that if I stepped through the code, it wouldn't crash. And you may notice that Inventor will execute the next command before the previous has finished updating completely. As such, by adding this tid bit of code to "hold Inventor back" it allows the command to finish processing and continue without crashing.

 

Sub...

...

duration = 15

....

Call oCompdef.Occurances.Add(...)

Call HoldOnInv(duration)

....

end sub

 

Function HoldOnInv(duration)
Dim PauseTime, Start
PauseTime = duration ' in seconds
Start = Timer

Do While Timer < Start + PauseTime
  DoEvents 'let's Inventor catch up
Loop
End Function

 

 

Hopefully this saves someone some headache! Night all!!

0 Likes
Accepted solutions (1)
386 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

5 second duration has been working thus far, depends on the computer power i think, 2 seconds crashes my desktop but not my laptop

0 Likes