Search the Community
Showing results for tags 'integer'.
-
In the Python SOP, I've run into a wall trying to get an integer converted to a string. In the larger picture, I'm trying to subtract 1 from a value which is currently part of a string. There are probably neater ways to write these steps, but I'm fairly new to Python so I'm writing it all out to make things easier to follow. I start with a string such as: string = "f27" Then remove the 'f' like so: string = string[1:] Convert it to an integer: integer = int(string) Subtract 1 from the value: integer -= 1 set new string string_new = "f" + str(integer) The last line returns an error on the Python SOP: TypeError: str() object is not callable. This is confusing because these same steps work just fine in the Python shell. Is there an alternative to str(), or am I using it wrong?
-
Hi I want to randomly select two points from a geo input in a VEX wrangle, so far I have this: int _selectedPts[]; _selectedPts[0] = rand(@numpt); _selectedPts[1] = rand(@numpt); setattrib(geoself(),"point", "Cd", _selectedPts[0], 0, {1,0,0}, "set"); setattrib(geoself(),"point", "Cd", _selectedPts[1], 0, {1,0,0}, "set"); I searched on the VEX docs but every random function I found could only return float numbers, but I need integer numbers. How can I solve this?
-
Ok, I have many objects separated into point groups by unique suffixes. I'd like to split the suffix integer value from the array of group names. Then assign that integer to a custom attribute. I'm terrible at VEX so any suggestions would be greatly appreciated.