I have only ever written a few lines and don´t really understand what I´m doing. So could any one please explain to me why this doesn´t work for "end = 0" and how could I make it work?
Thank you kindly :)
start = rs.GetInteger
end = rs.GetInteger
end = -end
objectIDs = rs.GetObjects("Pick some object")
for singleID in objectIDs:
name = rs.ObjectName(singleID)
name = name[start:end]
rs.ObjectName(singleID,name)
... so if the object name is 123456789 and I input 5 and 0 I get 6789. If I input 0 and 4 I get 12345. For 2 and 3 I get 3456, etc.
edit: OK, thank's to you I think I understand why it doesn´t work and I think I fixed it thus:
start = rs.GetInteger
if start == 0: start = None
end = rs.GetInteger
end = -end
if end == 0: end = None
objectIDs = rs.GetObjects("Pick some object")
for singleID in objectIDs:
name = rs.ObjectName(singleID)
name = name[start:end]
rs.ObjectName(singleID,name)