var iCountMem = 0;
var arrMem = new Array();
var dCurrent = null;
var iCnt = 0;
var deltaZ = 0;
var dMemLength = 0;
var dPz = 0;
var memberLoad = new MemberLoad();


//Horizontale Stäbe in Array arrMem schreiben
for (var i = 1; i < members.count()+1; ++i) 
{  
  if (abs(nodes[members[members.getNthObjectId(i)].node_end.no].coordinate_3 - nodes[members[members.getNthObjectId(i)].node_start.no].coordinate_3)<0.0001)
    {
	  
      arrMem[iCountMem] = [members[members.getNthObjectId(i)].no, 
	                       nodes[members[members.getNthObjectId(i)].node_start.no].coordinate_3, 
						   nodes[members[members.getNthObjectId(i)].node_start.no].coordinate_1]
      iCountMem = iCountMem + 1	  
     }
}


// Array arrMem nach Z-Koordinate sortieren
arrMem.sort(function(a,b){
	return a[1]-b[1];
});


// Array arrMem nach X-Koordinate sortieren
arrMem.sort(function(a,b){
	return a[2]-b[2];
});


// Glaseigengewicht
for (var i = 0; i < arrMem.length; ++i) 
{
       if (dCurrent ==null || abs(nodes[members[arrMem[i][0]].node_start.no].coordinate_1 - dCurrent)>0.0001)
	   {
          dCurrent = nodes[members[arrMem[i][0]].node_start.no].coordinate_1;
          iCnt = 1;
        } 
		else 
		{
			deltaZ = nodes[members[arrMem[i][0]].node_start.no].coordinate_3-nodes[members[arrMem[i-1][0]].node_start.no].coordinate_3;
			dMemLength = members[arrMem[i][0]].length;
			dPz = deltaZ*dMemLength*dGlassWeight/2*1000
			ddistB = dMemLength - dBlock
			memberLoad.Force(undefined, 
			                 load_cases[iLoadCase], 
							 arrMem[i][0], 
							 member_loads.LOAD_DISTRIBUTION_CONCENTRATED_2, 
							 [dPz, dBlock, dPz, dMemLength - 2*dBlock,false,false],
							 member_loads.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W_TRUE
							)
			memberLoad.Eccentricity("shear_center", 
			                         0, dez);
			//console.log('Stab=   '+arrMem[i][0]+', Pz=   '+dPz); 
            cnt++;
        }
}
 










