!*********************************************************************************************************************************************************!
!* 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. 																															 *!
!*********************************************************************************************************************************************************!

noseflag_%NoseLPS_bsl% = 1
noseflag_%NoseHPS_bsl% = 1

!========================================================================
! 1st do LPS

BSL_NUM = NoseLPS_bsl
Nlam    = NoseLPS_Nlam
SID     = NoseLPS_SID
DIVK    = Nose_DIVK
LAMDIREC = 1
*GET, BSLKP1, LINE, BSL_NUM, KP, 1         ! Get keypoint number at position 1
*GET, BSLKP2, LINE, BSL_NUM, KP, 2         ! Get keypoint number at position 2

!------------------------------------------------------------------------
!------------------------------------------------------------------------
!Identify Keypoint coordiante order
!Identify Keypoint line fraction
		*IF,KX(BSLKP1),LT,KX(BSLKP2),THEN
				BSLKP1_BSL_%BSL_NUM%=BSLKP1
				BSLKP2_BSL_%BSL_NUM%=BSLKP2
				LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
				LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
				BSL_%BSL_NUM%_INVERSE=0        !Baseline direction inverse flage
			*ELSEIF,KX(BSLKP1),GT,KX(BSLKP2)
				BSLKP1_BSL_%BSL_NUM%=BSLKP2
				BSLKP2_BSL_%BSL_NUM%=BSLKP1
				LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
				LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
				BSL_%BSL_NUM%_INVERSE=1        !Baseline direction inverse flage
			*ELSEIF,KX(BSLKP1),EQ,KX(BSLKP2)
!				*IF,KY(BSLKP1),LT,KY(BSLKP2),THEN
						BSLKP1_BSL_%BSL_NUM%=BSLKP1
						BSLKP2_BSL_%BSL_NUM%=BSLKP2
						LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
						LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
						BSL_%BSL_NUM%_INVERSE=0        !Baseline direction inverse flage
!					*ELSEIF,KY(BSLKP1),GT,KY(BSLKP2)	
!						BSLKP1_BSL_%BSL_NUM%=BSLKP2
!						BSLKP2_BSL_%BSL_NUM%=BSLKP1
!						LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
!						LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
!						BSL_%BSL_NUM%_INVERSE=1                !Baseline direction inverse flage
!					*ELSE
!				*ENDIF
			*ELSE	
		*ENDIF

!=============================================================================================
	DIVK_BSL_%BSL_NUM% = DIVK 
	Nlam_BSL_%BSL_NUM%_DIREC_%LAMDIREC% = Nlam
	LAMDIREC_BSL_%BSL_NUM% = LAMDIREC
! Link laminating information with baseline number
	bsl_seg%SID% = BSL_NUM   
! record baseline number acoording to section ID 
	LAMDIREC_BSL_%BSL_NUM% = LAMDIREC
	SID_BSL_%BSL_NUM%_DIREC_%LAMDIREC% = SID
!=============================================================================================
! Input the lamina layout (recomended input method)
! Thickness(dimensional) || Lamina(Layer)_id
!---------------------------------------------------------------------------------------------
*DEL,   SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DIM,   SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%, TABLE, Nlam, 2, 1,
*TREAD, SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%, UserLayoutLayerTypes/VABS_Layout_%SID%, txt,
!---------------------------------------------------------------------------------------------
! the sum of thickness increments referring to the model line corresponding to the layer numbers
*DEL,THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DIM,THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,Nlam,1       
	ADD=0
*DO,p,1,Nlam
	THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p) = ADD+SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)
	ADD = THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p)
*ENDDO
THADD=0
*DO,p,1,Nlam
	THADD = THADD+SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)
*ENDDO
THADD = 5*THADD  !Just to make the boundary line clear
!=============================================================================================
! Baseline analysis
ALLSEL,ALL
*GET,BCKPN,KP,0,NUM,MAXD
LSEL,S,LINE,,BSL_NUM
*DO,i,1,DIVK_BSL_%BSL_NUM%
	KL,BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1),BCKPN+i  !!!!Generate sampling points on picked baseline
*ENDDO
KSEL,S,KP,,BCKPN + 1, BCKPN + DIVK_BSL_%BSL_NUM%
*GET,KPC,KP,0,COUNT
*GET,KPMAX,KP,0,NUM,MAX
*GET,KPMIN,KP,0,NUM,MIN
!--------------------------------------------------------20140729
*DEL, SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
!--------------------------------------------------------
*DIM, SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
---------------------------------------------------------
i=0
*DO,j,KPMIN,KPMAX
	*IF,KSEL(j),EQ,1,THEN
		i=i+1
		SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i)=KX(j)
		SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i)=KY(j)
	*ELSE
	*ENDIF
*ENDDO
!---------------------------------------------------------
! Sampling pointwise slope array
*DO,i,1, DIVK_BSL_%BSL_NUM%
	SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i)  = LSY(BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1))
	SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i) = LSY(BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1))
	SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i) = LSX(BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1))
*ENDDO
!=====================================
! right side point asas
!------------------------------------------------------------------------20140808
*DO,i,1,ORIL_NUM
	*IF,i,EQ,1,THEN
			LSEL,S,LINE,,ORIL(i)
		*ELSE
			LSEL,A,LINE,,ORIL(i)
	*ENDIF
*ENDDO
!-------------------------------------
KSEL,S,KP,,BSLKP2
LSLK,R,0
LSEL,U,LINE,,BSL_NUM
*GET, BSL_right, LINE, 0, NUM, MIN
SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(DIVK_BSL_%BSL_NUM%)  = 0.5*( LSY(BSL_NUM,1) + LSY(BSL_right,0) )
SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(DIVK_BSL_%BSL_NUM%) = 0.5*( LSY(BSL_NUM,1) + LSY(BSL_right,0) )
SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(DIVK_BSL_%BSL_NUM%) = 0.5*( LSX(BSL_NUM,1) + LSX(BSL_right,0) ) 

!---------------------------------------------------------
!Delet used sampling points
KDELE, BCKPN + 1, BCKPN + DIVK_BSL_%BSL_NUM%


		*GET,CKPN,KP,0,NUM,MAXD
		*IF, SEGPK_BSL_%BSL_NUM%_DIREC_1(1), GT, 0, THEN	
		
				DX = THADD*ABS( SEGPKY_BSL_%BSL_NUM%_DIREC_1(1) )
				DY = THADD*ABS( SEGPKX_BSL_%BSL_NUM%_DIREC_1(1) )
		
				X_ITR = LX( BSL_NUM, LFRAC_BSLKP1_BSL_%BSL_NUM% ) + DX                             !X_ITR: new x coordinate
				Y_ITR = LY( BSL_NUM, LFRAC_BSLKP1_BSL_%BSL_NUM% ) - DY                             !Y_ITE: new y coordinate
		
			*ELSEIF, SEGPK_BSL_%BSL_NUM%_DIREC_1(1), EQ, 0
		
				X_ITR = LX( BSL_NUM, LFRAC_BSLKP1_BSL_%BSL_NUM% )
				Y_ITR = LY( BSL_NUM, LFRAC_BSLKP1_BSL_%BSL_NUM% ) - THADD
		
			*ELSEIF, SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1), LT, 0
		
				DX = THADD*ABS( SEGPKY_BSL_%BSL_NUM%_DIREC_1(1) )
				DY = THADD*ABS( SEGPKX_BSL_%BSL_NUM%_DIREC_1(1) )
		
				X_ITR = LX( BSL_NUM, LFRAC_BSLKP1_BSL_%BSL_NUM% ) - DX
				Y_ITR = LY( BSL_NUM, LFRAC_BSLKP1_BSL_%BSL_NUM% ) - DY
		
			*ELSE
		*ENDIF

		KLD1 = CKPN+1

		K, KLD1, X_ITR, Y_ITR, 0

/INPUT,VABS_APDL_Lamination/VABS_APDL_NoseAssemblyLine_Modules/RIGHT_SIDE_DIREC1_SSAS,mac

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


!========================================================================
! 2nd do HPS

BSL_NUM = NoseHPS_bsl
Nlam    = NoseHPS_Nlam
SID     = NoseHPS_SID
DIVK    = Nose_DIVK
LAMDIREC = 2

*GET, BSLKP1, LINE, BSL_NUM, KP, 1         ! Get keypoint number at position 1
*GET, BSLKP2, LINE, BSL_NUM, KP, 2         ! Get keypoint number at position 2

!------------------------------------------------------------------------
!------------------------------------------------------------------------
!Identify Keypoint coordiante order
!Identify Keypoint line fraction
		*IF,KX(BSLKP1),LT,KX(BSLKP2),THEN
				BSLKP1_BSL_%BSL_NUM%=BSLKP1
				BSLKP2_BSL_%BSL_NUM%=BSLKP2
				LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
				LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
				BSL_%BSL_NUM%_INVERSE=0        !Baseline direction inverse flage
			*ELSEIF,KX(BSLKP1),GT,KX(BSLKP2)
				BSLKP1_BSL_%BSL_NUM%=BSLKP2
				BSLKP2_BSL_%BSL_NUM%=BSLKP1
				LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
				LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
				BSL_%BSL_NUM%_INVERSE=1        !Baseline direction inverse flage
			*ELSEIF,KX(BSLKP1),EQ,KX(BSLKP2)
!				*IF,KY(BSLKP1),LT,KY(BSLKP2),THEN
						BSLKP1_BSL_%BSL_NUM%=BSLKP1
						BSLKP2_BSL_%BSL_NUM%=BSLKP2
						LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
						LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
						BSL_%BSL_NUM%_INVERSE=0        !Baseline direction inverse flage
!					*ELSEIF,KY(BSLKP1),GT,KY(BSLKP2)	
!						BSLKP1_BSL_%BSL_NUM%=BSLKP2
!						BSLKP2_BSL_%BSL_NUM%=BSLKP1
!						LFRAC_BSLKP1_BSL_%BSL_NUM%=0.0
!						LFRAC_BSLKP2_BSL_%BSL_NUM%=1.0
!						BSL_%BSL_NUM%_INVERSE=1                !Baseline direction inverse flage
!					*ELSE
!				*ENDIF
			*ELSE	
		*ENDIF

!=============================================================================================
	DIVK_BSL_%BSL_NUM% = DIVK 
	Nlam_BSL_%BSL_NUM%_DIREC_%LAMDIREC% = Nlam
	LAMDIREC_BSL_%BSL_NUM% = LAMDIREC
! Link laminating information with baseline number
	bsl_seg%SID% = BSL_NUM   
! record baseline number acoording to section ID 
	LAMDIREC_BSL_%BSL_NUM% = LAMDIREC
	SID_BSL_%BSL_NUM%_DIREC_%LAMDIREC% = SID
!=============================================================================================
! Input the lamina layout (recomended input method)
! Thickness(dimensional) || Lamina(Layer)_id
!---------------------------------------------------------------------------------------------
*DEL,   SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DIM,   SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%, TABLE, Nlam, 2, 1,
*TREAD, SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%, UserLayoutLayerTypes/VABS_Layout_%SID%, txt,
!---------------------------------------------------------------------------------------------
! the sum of thickness increments referring to the model line corresponding to the layer numbers
*DEL,THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DIM,THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,Nlam,1       
	ADD=0
*DO,p,1,Nlam
	THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p) = ADD+SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)
	ADD = THsum_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p)
*ENDDO
THADD=0
*DO,p,1,Nlam
	THADD = THADD+SEGLAM_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(p,1)
*ENDDO
THADD = 5*THADD  !Just to make the boundary line clear
!=============================================================================================
! Baseline analysis
ALLSEL,ALL
*GET,BCKPN,KP,0,NUM,MAXD
LSEL,S,LINE,,BSL_NUM
*DO,i,1,DIVK_BSL_%BSL_NUM%
	KL,BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1),BCKPN+i  !!!!Generate sampling points on picked baseline
*ENDDO
KSEL,S,KP,,BCKPN + 1, BCKPN + DIVK_BSL_%BSL_NUM%
*GET,KPC,KP,0,COUNT
*GET,KPMAX,KP,0,NUM,MAX
*GET,KPMIN,KP,0,NUM,MIN
!--------------------------------------------------------20140729
*DEL, SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
*DEL, SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%
!--------------------------------------------------------
*DIM, SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
*DIM, SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%,ARRAY,KPC,1
---------------------------------------------------------
i=0
*DO,j,KPMIN,KPMAX
	*IF,KSEL(j),EQ,1,THEN
		i = i+1
		SEGCX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i) = KX(j)
		SEGCY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i) = KY(j)
	*ELSE
	*ENDIF
*ENDDO
!---------------------------------------------------------
! Sampling pointwise slope array
*DO,i,1, DIVK_BSL_%BSL_NUM%
	SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i)  = LSY(BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1))
	SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i) = LSY(BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1))
	SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(i) = LSX(BSL_NUM,1/(DIVK_BSL_%BSL_NUM%-1)*(i-1))
*ENDDO
!=====================================
! right side point asas
!------------------------------------------------------------------------20140808
*DO,i,1,ORIL_NUM
	*IF,i,EQ,1,THEN
			LSEL,S,LINE,,ORIL(i)
		*ELSE
			LSEL,A,LINE,,ORIL(i)
	*ENDIF
*ENDDO
!-------------------------------------
KSEL,S,KP,,BSLKP2
LSLK,R,0
LSEL,U,LINE,,BSL_NUM
*GET, BSL_right, LINE, 0, NUM, MIN
SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(DIVK_BSL_%BSL_NUM%)  = 0.5*( LSY(BSL_NUM,1) + LSY(BSL_right,0) )
SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(DIVK_BSL_%BSL_NUM%) = 0.5*( LSY(BSL_NUM,1) + LSY(BSL_right,0) )
SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(DIVK_BSL_%BSL_NUM%) = 0.5*( LSX(BSL_NUM,1) + LSX(BSL_right,0) ) 

!---------------------------------------------------------
!Delet used sampling points
KDELE, BCKPN + 1, BCKPN + DIVK_BSL_%BSL_NUM%


		*GET,CKPN,KP,0,NUM,MAXD
		
		*IF,SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1),GT,0,THEN	
		
				DX = THADD*ABS(SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1))
				DY = THADD*ABS(SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1))
		
				X_ITR = LX(BSL_NUM,LFRAC_BSLKP1_BSL_%BSL_NUM%) - DX                                     !X_ITR: new x coordinate
		
				Y_ITR = LY(BSL_NUM,LFRAC_BSLKP1_BSL_%BSL_NUM%) + DY                                     !Y_ITE: new y coordinate
		
			*ELSEIF,SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1),EQ,0
		
				X_ITR = LX(BSL_NUM,LFRAC_BSLKP1_BSL_%BSL_NUM%)
		
				Y_ITR = LY(BSL_NUM,LFRAC_BSLKP1_BSL_%BSL_NUM%) + THADD
		
			*ELSEIF,SEGPK_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1),LT,0
		
				DX = THADD*ABS(SEGPKY_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1))
				DY = THADD*ABS(SEGPKX_BSL_%BSL_NUM%_DIREC_%LAMDIREC%(1))
		
				X_ITR = LX(BSL_NUM,LFRAC_BSLKP1_BSL_%BSL_NUM%) + DX
		
				Y_ITR = LY(BSL_NUM,LFRAC_BSLKP1_BSL_%BSL_NUM%) + DY
		
			*ELSE
		*ENDIF

		KLD2 = CKPN+1

		K, KLD2, X_ITR, Y_ITR, 0

/INPUT,VABS_APDL_Lamination/VABS_APDL_NoseAssemblyLine_Modules/RIGHT_SIDE_DIREC2_SSAS,mac

!===================================================================
! generate assembly line

ALLSEL,ALL
*GET, KPMOST, KP, 0, NUM, MAXD

KPMID_LD = KPMOST+1

KFILL, KLD1, KLD2, 1, KPMID_LD, 1, 1

L, BSLKP1_BSL_%BSL_NUM%, KPMID_LD

KSEL,S,KP,,BSLKP1_BSL_%BSL_NUM%
KSEL,A,KP,,KPMID_LD
LSLK,S,1
*GET,nosebondline,LINE,0,NUM,MAX
LB1_BSL_%NoseLPS_bsl%_DIREC_1 = nosebondline
LB1_BSL_%NoseHPS_bsl%_DIREC_2 = nosebondline


/INPUT,VABS_APDL_Lamination/VABS_APDL_NoseAssemblyLine_Modules/VABS_APDL_NoseArea,mac