I have a problem when i try to run a commend called by a FeatureUpdated event, i try to select the implied selected feature using this code :
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Edit
1. Does your command method have CommandFlags.UserPickSet flag set?
2. Have you debugged the code so that you knowwhich line of code is the offending one? That is, does AutoCAD Map pass through this line:
If result.Status <> PromptStatus.OK Then Exit Sub
If yes, then I think you need to test if the SelectionSet.Count>0 or not:
If result.Value.Count=0 Then Exit Sub
because if the count is 0, the next line of code would not get you a MgSelectionBase object.
Anyway, simply place a break point and then step through the code would allow you easily find the cause of crash.
Thank you for the reply
I have tried with and without CommandFlags.UserPickSet flag set, but there is the same result, Autocad crash when i try to get the layer of the MgSelBase. This is perhaps because i use this code with an event handler and when there are features checked out on the map, but i don't know.
I found another way to achieve what i wanted to do, i use the FeatureEventArgs of the eventhandler to identify the feature updated, instead of SelectImplied()
Handler added at the initialisation of the dll :
Dim fs As AcMapFeatureService = AcMapServiceFactory.GetService(MgServiceType.Featu
AddHandler fs.FeatureUpdated, AddressOf fs_FeatureUpdated
Function called when a modified feature is checked in :
Sub fs_FeatureUpdated(ByVal sender As Object, ByVal e As AcMapFeatureEventArgs)
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.