Editor: C++ calling SnapToFloor for StaticMesh

Apologies, there are similar questions to this, elsewhere; but, after 3 fruitless days of searching, I am stuck (and desperate).

Scenario: In the Editor, I want to place an arbitrary number of StaticMeshes on a Landscape; using preferably Python (or C++ if necessary, but I do want to make the facility more accessible than C++). I know the x,y of where I want to place each StaticMesh, but not the z of the landscape (at that x,y). Manually I would use the UI to place a StaticMesh above the Landscape (with the correct x,y) and use the End key, which invokes a SnapToFloor operation. Manually doing this is not an option, as there will be a lot of such objects to be placed (and this operation will be performed many times). I do not know how to achieve this apparently trivial, commonplace requirement. I have discounted raycasting (or line tracing), as this appears to be a runtime only operation. My favoured strategy is to spawn the StaticMesh Actors with the correct x,y and a z value just higher than the highest z of the landscape (which I know) and then (somehow) programmatically invoke SnapToFloor on each of the StaticMesh Actors. An alternative strategy would be if I could easily determine the z of a Landscape surface at some arbitrary x,y. But, I’ve also had very little luck in this direction.

After extensive Googling and reading of API documents, I resorted to examining the UE4 source code, but without much success. I think that I have found where this happens in LevelEditorActions.cpp. Following the code leads to a UEditorEngine.cpp method: SnapObjectTo(args). But, I have no idea how to get a reference to (presumably) the one instance of this, from Python (or C++) code.

I would really appreciate some help please. I am sure that I am not alone in wanting this. Thank-you, in anticipation.

PS I am aware that the landscape will not be flat, where each StaticMesh lands on the floor, but I have a solution for this.

Additional Keywords: SnapToFloor SnapToFloor_Clicked SnapTo_Clicked SnapObjectTo GEditor

Workaround Strategy: Within Python (or C++) code the StaticMeshes can be selected automatically (using some arbitrary criteria, I will use the content path) and then the End key pressed manually. I will confirm whether this works, soon. However, it is not the desired answer, as I want the human/manual aspects of the workflow to focus on where humans add differentiating value (eg creativity) and I want to automate the mundane. My aim here is to automatically populate a level with Actors, prior to human intervention. So even if this workaround strategy works. It is seriously sub-optimal and I am baffled why it is so hard to make a trivial Editor operation so difficult to make available to automation code.

I can confirm that this does work. Two additional tips:

(1) Having run the Python script to select the target objects, ensure that the screen focus is on the Viewport (eg if it is on the World Outliner, then End key will operate there; which is not what you want).
(2) If you are using Python Modules and changing them whilst the UE4 Editor remains open, you will have to reload a module each time it is changed, as the UE4 Python implementation clearly maintains a cached copy of modules.

BTW I used the following API Methods
unreal.EditorLevelLibrary.get_all_level_actors()
unreal.EditorFilterLibrary(actors,searchText,unreal.EditorScriptingStringMatchType.MATCHES_WILDCARD)
unreal.EditorLevelLibrary.set_selected_actors(actors)

In this case, I happened to identify the target objects using an Object’s Label, this technique could be applied to any arbitrary selection logic