Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I'm developing an Add-In and I am facing an issue.
At some point in the process, I am placing a part with user interaction. The component placement is working correctly.
However, until the user hits the escape key or "right-click -> Done", each click will place a new occurrence of the component. I would like to prevent the user of placing multiple component.
In my main routine, I am using the command manager to place a component:
CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, FilePath)
CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute()
And using the OnNewOccurrence event handler I am trying to stop the command after the first item is placed.
I have tried the following:
Private Sub AssemblyEvents_OnNewOccurrence(...) Handles AssemblyEvents.OnNewOccurrence
If BeforeOrAfter = EventTimingEnum.kAfter Then
CommandManager.StopActiveCommand()
'This will throw an exception
CommandManager.ControlDefinitions.Item("AppContextual_DoneCmd").Execute()
CommandManager.ControlDefinitions.Item("AppContextual_CancelCmd").Execute()
CommandManager.ControlDefinitions.Item("AppContextual_OKCmd").Execute()
'Those three command seem to have no effect
End If
End Sub
Is there any way to stop the AssemblyPlaceComponentCmd with the API?
Solved! Go to Solution.