rs.Command in class? [Solved]

Hi, I am working on a simple script in python that will produce a slab and I got a strange result when I put the

rs.Command("_Dir SelID " + str(surface2)+ " _Enter Flip _Enter ") line

in the class.

The script could not reach the surface2 GUID but gives a partial multi rows message with errors:

First row is also strange: as sais “Wall thickness: _Dir”. Wall thickness occurs in the main object only when I give the input, but not in the class.

[7ce0e3e7-6b89-43ee-8cb6-f7cc3759e1d9]>] is actually surface2 that I want to process.

Wall thickness: _Dir
Select objects for direction display: SelID[<System.Guid
Unknown command: SelID[<System.Guid
Select objects for direction display: object
Unknown command: object
Select objects for direction display: at
Unknown command: at
Select objects for direction display: 0x000000000000005D
Unknown command: 0x000000000000005D
Select objects for direction display: [7ce0e3e7-6b89-43ee-8cb6-f7cc3759e1d9]>]_Enter
Unknown command: [7ce0e3e7-6b89-43ee-8cb6-f7cc3759e1d9]>]_Enter
Select objects for direction display: Flip
Select objects for direction display: _Enter

seems you are missing a space between SelID and the actual ID

Thanks, it gives the same result.

I found it; I had to add the geometry to the tables and get the id in the rs.Command

    surface2CO = rs.coercebrep(surface2)
    obj = sc.doc.Objects.AddBrep(surface2CO)
    sc.doc.Views.Redraw()
    rs.Command("_Dir SelID " + str(obj)+ " _Enter Flip _Enter ")