Save vcProperty as Integer


I have this setup where I have a pallet filled with bags. The weight of these bags have to been inbetween a min and a max value. To do this a added a distribution property to the bag with uniform(15,20).

The thing now is that the value of (for example 16.602) that property is not an integer but it is seen as a vcProperty. When i try to use the int(vcProperty) it ofcorse says that the argument must be a number or string. Is there another way to make the distributionProperty an integer?


Could you elaborate a bit further (or post a snippet of your code). It looks like you’re trying to convert a type of object into integer.

In general the code should looks something like this:

comp = getComponent() #type of object: vcComponent
my_prop = comp.getProperty(‘name_of_your_prop’) #type of object: vcProperty
print my_prop.Value

The basic notation dot notation (as you probably already know) allows you to access attributes of the objects. What the error message looks like, is that you’re trying to explicitly convert a full object into an integer like this:
int(my_prop) → type error


I already found a solution but thanks for helping! What I did is add an extra behaviour with a real value and connect the property value to the behaviour. This way I can add the real value to a list and use it as a number instead of a distribution property