function buttonselectIPRAY(hObject, eventdata, parentfig, Empty_Button, AxesAFS, AxesSOL, lcs, roton, rotoff, IPonoff, SegPlot, type);
data = get(Empty_Button,'UserData');

if data.isafs == 0
    set(IPonoff(1), 'Value', 0);
    set(IPonoff(2), 'Value', 1);
    return;
end

AFSview = get(AxesAFS,'view');

if type == 1
    if get(IPonoff(1), 'Value')
        data.plotIP = 1;
    else
        data.plotIP = 0;
    end
else
    if get(IPonoff(1), 'Value')
        data.plotFP = 1;
    else
        data.plotFP = 0;
    end
end

pv = get(SegPlot, 'Value');
if pv == 1
    plotafsRAY(parentfig, data, AxesAFS, AxesSOL, lcs);
else
    [xm, ym, zm] = plotsegRAY(data, AxesAFS, pv, lcs);
end

set(AxesAFS, 'view', AFSview);

set(Empty_Button,'UserData',data);
