- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @PumaBH. It sounds like it is getting different documents mixed up. And since this is the case, we have to take a very close look at how we are getting a document for this code to work with. In your code, you are using the 'ThisDoc' term in several places, but then you are also using the 'ThisApplication.ActiveDocument' term, which could be retrieving a different document object than what the 'ThisDoc' term is pointing to. So, I would suggest that you replace 'ThisApplication.ActiveDocument' with 'ThisDoc.Document', instead. That way all of those terms should be pointing to the same document. The term 'ThisApplication.ActiveDocument' will always capture the document that is currently, visibly showing on your Inventor screen at the moment that code is encountered. If that code gets ran by events or gets ran remotely, then the wrong document may be showing on your Inventor screen at that time, causing the problem. The term 'ThisDoc' has pretty dynamic functionality, and works differently in different situations, in an attempt to point to the most relevant document, and is the term I use most within most of my iLogic rules. It was not always that way though. I had to learn about this situation myself at one point, then made the change because of it.
Wesley Crihfield
(Not an Autodesk Employee)