function ret=CstCheck3D(Cxd,Cxh,Cyd,Cyh,Czd,Czh,CComponent,CName)
global mws solid ;
solid = mws.invoke('Solid');
krok = 10;
Cx=Cxh-Cxd;
Cxx = Cx;
Cy=Cyh-Cyd;
Cyy=Cy;
Cz=Czh-Czd;
Czz=Cz;
ret = 0;
    if (Cx<=krok)
        Cx(1)=Cxd;
        Cx(2)=Cx/2;
        Cx(3)=Cxh;
    else
        r=1;
       while (Cx >=krok)
           Cx=Cx-krok;
           r=r+1;
       end
       for i=2:r+1
           Cx(1) = Cxd;
           Cx(i) = ((Cxx/r)*(i-1))+Cx(1);
       end
    end
    
    if (Cy<=krok)
        Cy(1)=Cyd;
        Cy(2)=Cy/2;
        Cy(3)=Cyh;
    else
        r=1;
       while (Cy >=krok)
           Cy=Cy-krok;
           r=r+1;
       end
       for i=2:r+1
           Cy(1) = Cyd;
           Cy(i) = ((Cyy/r)*(i-1))+Cy(1);
       end
    end
    
    if (Cz<=krok)
        Cz(1)=Czd;
        Cz(2)=Cz/2;
        Cz(3)=Czh;
    else
        r=1;
       while (Cz >=krok)
           Cz=Cz-krok;
           r=r+1;
       end
       for i=2:r+1
           Cz(1) = Czd;
           Cz(i) = ((Czz/r)*(i-1))+Cz(1);
       end
    end
    
    [nx,mx]=size(Cx);
    [ny,my]=size(Cy);
    [nz,mz]=size(Cz);
   for i=1:mx
       for j=1:my
           for k=1:mz
               ret = solid.invoke('IsPointInsideShape',Cx(i),Cy(j),Cz(k),CComponent,':',CName);
               if (ret==1)
                   ret = 1;
                   return;
               end
           end
       end
   end
end
