- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Edit: Sorry, please disregard this, I just found that my code sets thisapplicaiton.silentoperation = true somewhere else..
I am using Inventor 2022.1
I have a userform with a button to place parts based on filename in an assembly using command manager and AssemblyPlaceComponentCmd.
The issue I am having is when I call cmdMgr.PostPrivateEvent(kFileNameEvent, fname), it disables save functionality (hitting save button or ctrl-s does nothing) and the usual Inventor prompts for things like design doctor issues and prompting for save when closing a document do not appear. I narrowed it down to this line of code through trial and error. Any changes made after placing a part this way are lost and the only way to fix it is to restart Inventor.
Here is the code I am using. fname comes from a tree on the userform you pick your part and it looks up a filename from an xml file:
Private Sub btnPlace_Click()
'MsgBox ("Selected: " & displayNodesXML.item(lstBxSelections.ListIndex).Attributes.getNamedItem("name").Text)
Dim fname As String
fname = displayNodes.item(lstBxSelections.ListIndex).Attributes.getNamedItem("location").Text
Me.Hide
' Post the filename to the private event queue.
Dim cmdMgr As CommandManager
Set cmdMgr = ThisApplication.CommandManager
Call cmdMgr.ClearPrivateEvents
Call cmdMgr.PostPrivateEvent(kFileNameEvent, fname)
' Execute the "Place Component" command.
cmdMgr.ControlDefinitions.item("AssemblyPlaceComponentCmd").Execute
End Sub
Let me know if anyone has experienced this, has a workaround or a different way of placing parts.
Thanks
Solved! Go to Solution.