You need to align on the feature that you want filtering (only origin for the sphere, origin and level for cone and cylinder).
The case in this code is a sphere filtered from a measured auto sphere.
Hope it's usefull...
REF2 =ALIGNMENT/START,RECALL:REF1,LIST=YES ALIGNMENT/TRANS,XAXIS,SPH2 ALIGNMENT/TRANS,YAXIS,SPH2 ALIGNMENT/TRANS,ZAXIS,SPH2 ALIGNMENT/END DISPLAYPRECISION/6 ASSIGN/V1=SPH2.NUMHITS ASSIGN/V2=DOT(SPH2.HIT[1..V1].XYZ-SPH2.HIT[1..V1].TXYZ,SPH2.HIT[1..V1].TIJK) ASSIGN/V3=SUM(V2)/V1 ASSIGN/V4=SQRT(SUM((V2-V3)^2)/(V1-1)) ASSIGN/V5=V2-V3 ASSIGN/V6=0 V7 =LOOP/START,ID=YES,NUMBER=V1,START=1,SKIP=, OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0 IF/ABS(V5[V7])<[COLOR=#FF0000]3[/COLOR]*V4 ASSIGN/V6=V6+1 F1 =GENERIC/POINT,DEPENDENT,CARTESIAN,$ NOM/XYZ,<SPH2.HIT[V7].TX,SPH2.HIT[V7].TY,SPH2.HIT[V7].TZ>,$ MEAS/XYZ,<SPH2.HIT[V7].X,SPH2.HIT[V7].Y,SPH2.HIT[V7].Z>,$ NOM/IJK,<SPH2.HIT[V7].TI,SPH2.HIT[V7].TJ,SPH2.HIT[V7].TK>,$ MEAS/IJK,<SPH2.HIT[V7].I,SPH2.HIT[V7].J,SPH2.HIT[V7].K> END_IF/ LOOP/END SPH3 =FEAT/SPHERE,CARTESIAN,OUT,LEAST_SQR,NO THEO/<0,0,0>,<0,0,1>,0 ACTL/<-0.018452,0.000041,0.000159>,<0,0,1>,60.046132 CONSTR/SPHERE,BF,F1[1..V6],,
V2 is the T values array
V3 is the average of t values
V4 is the standard dev of t values
V5 is the re-centered t_values array (each value minus the average)
V6 count the number of hits after filtering
If statement selects tvalue (if abs of t value is lower than n std dev, hit is selected, else it's rejected)
Display precision is setted to 6 because the standard dev can be very few, so it avoids resulting zero !!!!!