!*********************************************************************************************************************************************************!
!* Copyright (c) <2015> <Purdue University> All rights reserved.																					     *!
!*                                                                      																			     *!
!* Developed by:  Fang Jiang, Wenbin Yu                                                                                                                  *!
!*        <Prof. Yu’s Research Group>,                                                                                                                   *!
!*        <School of Aeronautics and Astronautics, Purdue University>                                                                                    *!
!*        <https://cdmhub.org/projects/ansysvabsgui2015>                                                                                                 *!
!*                                                                      																			     *!
!* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),    *!
!* to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,  *!
!* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:            *!
!*                                                                      																			     *!
!* •Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.                        *!
!*                                                                      																			     *!
!* •Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation *!
!*  and/or other materials provided with the distribution.                                                                                               *!
!*                                                                      																			     *!
!* •Neither the names of < Prof. Yu’s Research Group, School of Aeronautics and Astronautics, Purdue University >,                                       *!
!*  nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.   *!
!*                                                                      																			     *!
!* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *!
!* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *!
!* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER     *!
!* DEALINGS WITH THE SOFTWARE. 																															 *!
!*********************************************************************************************************************************************************!
!==================================================================================================================
!==================================================================================================================
!==================================================================================================================
!Generate Big Area--web

		p = Nlam_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
			*GET,CKPN,KP,0,NUM,MAXD
			LSEL,S,LINE,,LKP1
			THsum_COS_LENG_1=THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)/cos(PHI_1_BSL_%BSL_NUM%_DIREC_%LAMDIREC%)			
			*IF,KX(LLSIDE_KP1_BSL_%BSL_NUM%_DIREC_%LAMDIREC%),EQ,KX(BSLKP1_BSL_%BSL_NUM%),AND,KY(LLSIDE_KP1_BSL_%BSL_NUM%_DIREC_%LAMDIREC%),EQ,KY(BSLKP1_BSL_%BSL_NUM%),THEN
					KL,LKP1,(THsum_COS_LENG_1/LENGKP1),CKPN+1
				*ELSE
					KL,LKP1,((LENGKP1-THsum_COS_LENG_1)/LENGKP1),CKPN+1	
			*ENDIF					
			!--------------------------------------------------------------------------------------------------------------------------------------------------------------		
			*DO,j,2,KPC-1
					*IF,SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j), GT, 0, THEN	
					
							DX = THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)*ABS(SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j))
							DY = THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)*ABS(SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j))
					
							X_ITR = SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j) - DX                             !X_ITR: new x coordinate
							Y_ITR = SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j) + DY                             !Y_ITE: new y coordinate
										
						*ELSEIF, SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j), LT, 0
					
							DX = THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)*ABS(SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j))
							DY = THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)*ABS(SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j))
					
							X_ITR = SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j) - DX
							Y_ITR = SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(j) - DY
					
						*ELSE
					*ENDIF
					K,CKPN+j,X_ITR,Y_ITR,0
			*ENDDO
			!--------------------------------------------------------------------------------------------------------------------------------------------------------------
			LSEL,S,LINE,,LKP2
			THsum_COS_LENG_2=THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)/cos(PHI_2_BSL_%BSL_NUM%_DIREC_%LAMDIREC%)		
			*IF,KX(RLSIDE_KP1_BSL_%BSL_NUM%_DIREC_%LAMDIREC%),EQ,KX(BSLKP2_BSL_%BSL_NUM%),AND,KY(RLSIDE_KP1_BSL_%BSL_NUM%_DIREC_%LAMDIREC%),EQ,KY(BSLKP2_BSL_%BSL_NUM%),THEN
					KL,LKP2,(THsum_COS_LENG_2/LENGKP2),CKPN+KPC
				*ELSE
					KL,LKP2,((LENGKP2-THsum_COS_LENG_2)/LENGKP2),CKPN+KPC	
			*ENDIF		
			!--------------------------------------------------------------------------------------
			KSEL,ALL
			KSEL,S,KP,,CKPN+1,CKPN+KPC
			SPLINE,ALL
			LSLK,S,1

			*DEL, abig_bottom_kp_BSL_%BSL_NUM%
			*DIM, abig_bottom_kp_BSL_%BSL_NUM%, ARRAY, DIVK_BSL_%BSL_NUM%, 1
			*DO,i,1, DIVK_BSL_%BSL_NUM%
				abig_bottom_kp_BSL_%BSL_NUM%(i) = CKPN+i
			*ENDDO

			!-----------------------------------
			KSEL,ALL
			L,CKPN+1-KPC,CKPN+1
			L,CKPN,CKPN+KPC
			!-----------------------------------
			KSEL,S,KP,,CKPN+1-KPC,CKPN+KPC
			LSLK,S,1
			AL,ALL


!===========================================================================================================================================	
AllSEL,ALL
LPLOT

!=============
/PNUM,KP,0  
/PNUM,LINE,0
!/PNUM,AREA,1
!/PNUM,VOLU,1
!/PNUM,NODE,1
!/PNUM,TABN,1
!/PNUM,SVAL,1
!/PNUM,ELEM,1
!--------------
/NUMBER,1 !Specify whether numbers, colors, or both are used for displays 
		  !	0:color and number; 
		  !	1:only color; 
		  !	2:only number; 
		  !-1:nothing
!===============
