I want to model the process of mounting 2 elements with 4 screws. I have shaft (1st input in combiner), plate (2nd input in combiner) and 4 screws (3rd input in combiner). I am trying to put the screws inside the holes you can see below. Changing location of the plate is simple and it works:
it is done by trigger on entry - custom code:
Object current = ownerobject(c);
Object item = param(1);
int port = param(2);
if(port == 2) {
//setloc(item,1.71,-1.51,1.81);
setloc(item,-0.15,-0.13,0.77);
}
but I can not handle with changing position of any of the screws. Screenshot below.:
I was trying with that code (it doesn't work):
if (port == 3) {
for (int i = 1; i <= getvarnode(Model.find("Combiner1"),"componentlist").as(Table)[2][1]; i++) {
switch (i) {
case 1:
setloc(item.subnodes[i],0.16,-0.2,1);
setrot(item.subnodes[i],0,90,0);
break;
case 2:
setloc(item.subnodes[i],1.92,-1.42,2.01);
setrot(item.subnodes[i],0,90,0);
break;
case 3:
setloc(item.subnodes[i],2.07,-1.58,2.01);
setrot(item.subnodes[i],0,90,0);
break;
case 4:
setloc(item.subnodes[i],2.07,-1.43,2.01);
setrot(item.subnodes[i],0,90,0);
break;
default:
break;
}
}
I would be very grateful for your help :)