Hi,
You can do this by implementing the Commandmanager.UserInputEvent.OnPreselect
You did not mention if you wanted to do this from Ilogic, VBA or .NET addin.
Unless you do it from an addin, you will need a user input to subscribe to such event. In VBA, you would create a class module that implement UserInputEvents
Dim WithEvents oEvents As UserInputEvents
Private Sub Class_Initialize()
Dim oCommandManager As CommandManager
Set oCommandManager = ThisApplication.CommandManager
Set oEvents = oCommandManager.UserInputEvents
End Sub
Private Sub oEvents_OnPreSelect(ByVal PreSelectEntity As Object, DoHighlight As Boolean, MorePreSelectEntities As ObjectCollection, SelectionDevice As SelectionDeviceEnum, ModelPosition As Point, ViewPosition As Point2d, View As View )
If TypeOf PreSelectEntity Is SurfaceBody Then
End If
End Sub
Your macro would create a new object of type (class_name).