Use of WZSphDef

Hi everyone,
I wrote this Rapid code to control TCP position. I want the blue light(Lampe_Bleu) to be on when the TCP reach into the sphere. This code does'nt work.
I wrote this Rapid code to control TCP position. I want the blue light(Lampe_Bleu) to be on when the TCP reach into the sphere. This code does'nt work.
VAR shapedata Sphere;
CONST num Rayon_sphere :=150;
VAR pos Centre_Sphere;
!Zone où la lumière bleue est allumée
VAR wztemporary ZoneRetrait_interne:=[0];
!Zone où la lumière bleue est éteinte
VAR wztemporary ZoneRetrait_externe:=[0];
!Appel des alias entrées/sorties
Demonination_entrees_sorties;
!Affectation du centre de la sphère à surveiller
Centre_Sphere:=rRetrait.trans;
TPWrite "centre de sphère" \Pos:=Centre_Sphere;
! Activation de la lumière bleue à 150 mm de la position rRetrait
WZFree ZoneRetrait_Interne;
WZSphDef\Inside,Sphere,Centre_Sphere,Rayon_sphere;
WZdoset\temp,ZoneRetrait_Interne\Inside,Sphere,Lampe_Bleu,Allume;
! Desactivation de la lumière bleue à plus 150 mm de la position rRetrait
WZFree ZoneRetrait_Externe;
WZSphDef\Inside,Sphere,Centre_Sphere,Rayon_sphere;
WZdoset\temp, ZoneRetrait_Externe\inside,Sphere,Lampe_Bleu,Eteint;
WzEnable ZoneRetrait_interne;
Comments