For drawing automation you need to get the intents from the model. Therefore we have the method View.GetIntent(...)
but this method throws an exception if the intent was not found. This happens to me a lot because my models are also automated and faces are regularly suppressed. Which breaks my drawing automation.
Can we get a function that would not throw an exception but returns a default value (Nothing). Something like the Enumerable.FirstOrDefault(...) method.
This is the extension method that I use for these situations: (I didn't implement all the optional parameters but you get the idea.)
''' <summary>
''' Same as the default iLogic methode but returns nothing if the intent is not found.
''' (instead of throwing an exception)
''' </summary>
<Runtime.CompilerServices.Extension() >
Public Function GetIntentOrDefault(view As IManagedDrawingView, modelEntityName As String, pointIntent As PointIntentEnum) As GeometryIntent
Dim intent = Nothing
Try
intent = view.GetIntent(modelEntityName, pointIntent)
Catch ex As Exception
End Try
Return intent
End Function