Bug report when setting Face Name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
InvApp is a normal Marshall reference that works for everything else in my .dll.
Dim thisDoc As PartDocument = InvApp.ActiveDocument
Dim oPartCompDef As PartComponentDefinition = thisDoc.ComponentDefinition
Dim frontFace As Face = thisDoc.SelectSet.Item(1)
Const iLogicAddinGuid As String = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"
Dim addin As ApplicationAddIn = InvApp.ApplicationAddIns.ItemById(iLogicAddinGuid)
Dim iLogicAuto As Object = addin.Automation
Dim namedEntities As Object = iLogicAuto.GetNamedEntities(oPartCompDef.Document)
namedEntities.SetName(frontFace, "FrontFace")
Intermittently, an exception will throw on .SetName (ArgumentException): Controls created on one thread cannot be parented to a control on a different thread error.
This exception only happens if there are no existing named faces in the part. The exception appears to be related to creating the "Geometry" tab under the iLogic tab.
This bug is INTERMITTENT and I have no idea what causes it to stop happening. I have tried restarting the computer, starting in brand new parts in inventor, etc. I was seeing the bug happen reliably, and then suddenly it stopped happening with the exact same code. There is no multithreading in my application, although I had
Imports System.Threading at the top of my code, it has been grayed out the whole time and as such is not being used for anything.