Select automatically a surface out of python script


I recently started using python scripts, and now I want to use the “AttachGHSData” tool, but my question is even larger than only this tool.

Since RhinoScriptSyntax does not include a function to call for this tool, I have to call it with rs.Command(“-AttachGHSData …”), as if I was doing it manually in command line. The next options works fine with python as they are only lists of characters to put in rs.Command.

However, at one point, I have to “select surface”, which is placing me out of the script for manual selection of a surface, but I would like to select it automatically in the script. I have no clue for doing so or if it is possible, any idea ?

Selection before calling the tool is not working
because the selection stops when calling it, and I don’t succeed calling a layer by its name in command line, I can only click on the surface.

Example of script which requires manual selection when I don’t want to:

import rhinoscriptsyntax as rs

rs.Command("-AttachGHSData TankItems Edit TANK1 Tank ")

Check out rs.GetObject()…

Thank you for your answer, but it seems I can’t call rs functions inside rs.Command(-AttachGHSData…). I tried it with each possible option (and I tried other selections methods from rs too), but if I do it before the rs.Command, selection is canceled at the start of command line actions. And once arrived at the point of selection, the rest of the script is paused so I can’t use rs.GetObject() neither.

By the way my example was not good, my mistake, the problem would be more with this script:

import rhinoscriptsyntax as rs

rs.Command("-AttachGHSData TankItems Add ")