View Single Post
  #6  
Old 12-15-2015
Jing Chen
Guest
 
Posts: n/a
Downloads: 2
Uploads: 0
Talking Find a method!

Many thanks to advice of Arun KR and Jörg.
I try to combine the advantage of two methods, and it works well!
Now I share with everyone.


treenode conveyor = node("Conveyor1", model());
treenode dp = node("DP1", model());
double distance = 9;
double x = distance - 0.5*xsize(dp);
double y = 0.5*ysize(dp);
double z = x/getvarnum(conveyor, "length")*getvarnum(conveyor, "rise")+0.01;

double model_x = vectorprojectx(conveyor,x,y,z,model());
double model_y = vectorprojecty(conveyor,x,y,z,model());
double model_z = vectorprojectz(conveyor,x,y,z,model());

setloc(dp,model_x,model_y,model_z);
set(node("/distAlong",node(">variables/conveyorPoint/1+",dp)),distance);


Node "dp" is the reference of the decision point want to edit, node "conveyor" is where the dp on, the value distance is the set distance from the entry point.
Reply With Quote
The Following 4 Users Say Thank You to Jing Chen For This Useful Post:
arunkrmahadeva (12-15-2015), Jörg Vogel (12-15-2015), Sebastian Hemmann (12-15-2015), Sung Kim (12-21-2015)