How do you access Copy attributes


#1

For examples: If I have object Stud with the copy attribute set to 15. How does a sibling object get access to

Stud copy 003 X attribute

Stud copy 003!X does not work

Stud!X[3] does not work

There should be a way to read the instance attributes


Referencing component instances/copies
#2

You state the conditions in the first component using the copy number , so if copy = 3, then x=300 say, otherwise some other value

X = if(and(copy>0,copy<7),choose(copy, 5,-10,300,0,y/3,z),50)

edit you say the copy attribute is 15, that should be copies. copy refers to copy number, and is a variable of copies.


#3

You should get the right syntax when you click on the attribute you want to reference when you are inputting the formula in your attribute. (something like Stud!Copies, depending the name of the attribute).

I understand that attributes can only be passed up or down in the component hierarchy. You might have to create an attribute in your parent component that reads the copies value from child1 and then you make your child2 reference that.

Anssi


#4

Thanks for the quick response

This is the formal I’m using to place a stud

x=if(copy=0,0,if(copy=Copies,Bottom!L-h,copy*WallNS!onCenter-(H/2+3.5)))

I want another object to be next to stud copy 003.

So the formula for the other object should be
x=Stud copy 003!x, but this is not valid syntax, nor is
x=Stud!x[3] valid

The instance copies of the stud are displayed in outliner, but the instance copies are NOT displayed in Components Attribute Window, so I do not see a way to click on the attribute to get the formula.


#5

went for dinner…

so in the stud component, create an attribute

pos =if (copy=3, x,0)

so from the object, reference that…
x = stud!pos

could you post your component, then easier to figure?


#6

thats not going to work as copy will place it back @ 0…need to think…please post the file anyway


#8

pos=if(copy=0,0,if(3=Copies,Bottom!L-h,3*WallNS!onCenter-(H/2+3.5)))

gets the position for copy =3, by plugging in value, so the object has its reference position


#9

A work around is to do as you suggest and create an attribute with the 3rd stud

The stud x is given by
x=if(copy=0,0,if(copy=Copies,Bottom!L-h,copy*WallNS!onCenter-(H/2+3.5)))

since I’m only interested in copy 3, it can be simplified to
pos=3*WallNS!onCenter-(H/2+3.5)
now pos will always have the value of the third stud.

I would prefer not to have to create a special attribute each time I want access to an attribute on instance objet. There must be some simple syntax that will allow access to instance attributes.


#10

something the sketchup guys can to add to their list…I am really hoping that they do some improvement for DCs soon…like the next release.


#11

I’ve not done anything with ruby yet, that will be my next step if I can not find a way to do this with just simple attribute formulas.