Hi,
I would like to use FlexScript to create a path vertically and create a CP in the middle of it. Is it possible?
I tried the code below, but it doesn't work. When finalizeSpatialChanges is executed on the last line, the z coordinate of the control point becomes -nan(ind).
Vec3 startloc = Vec3(0,0,0); Vec3 endloc = Vec3(0,0,10); Vec3 diff = endloc - startloc; Vec2 xydiff = Vec2(diff.x, diff.y); double xylength = xydiff.magnitude; double zlenght = Math.fabs(diff.z); Object path = Object.create("AGV::StraightPath"); path.size.x = xylength; path.size.z = zlenght; path.location = startloc; path.rotation.z = xydiff.angle(Vec2(1,0)); function_s(path, "setZ", startloc.z, 1); function_s(path, "setZ", endloc.z, 0); function_s(path, "finalizeSpatialChanges"); Vec3 cploc = Vec3(0,0,5); Object cp = Object.create("AGV::ControlPoint"); cp.location = cploc; function_s(cp, "finalizeSpatialChanges");
Thanks in advance.