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

!====================================================================
*IF, BSL_PLOT, NE, 0, AND, ANUM_PLOT, EQ, 0, THEN

		LD = LAMDIREC_BSL_%BSL_PLOT%
		nlam = NLAM_BSL_%BSL_PLOT%_DIREC_%LD%
		ASEL, S, AREA, , anum_BSL%BSL_PLOT%(1)
	
		*DO,i,2,nlam
	
			ASEL, A, AREA, , anum_BSL%BSL_PLOT%(i)               !get Area number from layer order
	
		*ENDDO
	
		!-------------------------------------------------------
		
		*IF, num_flag, EQ, 1, THEN
		
				/NUMBER, 0   ! number + color
		
			*ELSEIF, num_flag, EQ, 2
				
				/NUMBER, 1   ! color
		
			*ELSEIF, num_flag, EQ, 3
		
				/NUMBER, 2   ! number
		
			*ELSEIF, num_flag, EQ, 4
		
				/NUMBER, -1   ! nothing
		
			*ELSE
		*ENDIF
	
		!-------------------------------------------------------
		
		*IF, show_flag, EQ, 1, THEN  ! plot segment areas
		
				/PNUM, LINE, 0
				/PNUM, AREA, 1
				/PNUM, VOLU, 0
				/PNUM, NODE, 0
				/PNUM, TABN, 0
				/PNUM, SVAL, 0
				/PNUM, ELEM, 0
				/PNUM, KP, 0
				APLOT
		
			*ELSEIF, show_flag, EQ, 2   ! plot segment lines
				LSLA,S
				/PNUM, LINE, 1
				/PNUM, AREA, 0
				/PNUM, VOLU, 0
				/PNUM, NODE, 0
				/PNUM, TABN, 0
				/PNUM, SVAL, 0
				/PNUM, ELEM, 0
				/PNUM, KP, 0
				LPLOT
		
			*ELSEIF, show_flag, EQ, 3   ! plot segment kpoints
				LSLA,S
				KSLL,S
				/PNUM, LINE, 0
				/PNUM, AREA, 0
				/PNUM, VOLU, 0
				/PNUM, NODE, 0
				/PNUM, TABN, 0
				/PNUM, SVAL, 0
				/PNUM, ELEM, 0
				/PNUM, KP, 1
				KPLOT
		
			*ELSE	
		*ENDIF

	*ELSEIF, BSL_PLOT, NE, 0, AND, ANUM_PLOT, NE, 0
	
		ASEL, S, AREA, , anum_BSL%BSL_PLOT%(ANUM_PLOT)	

		!-------------------------------------------------------
		
		*IF, num_flag, EQ, 1, THEN
		
				/NUMBER, 0   ! number + color
		
			*ELSEIF, num_flag, EQ, 2
				
				/NUMBER, 1   ! color
		
			*ELSEIF, num_flag, EQ, 3
		
				/NUMBER, 2   ! number
		
			*ELSEIF, num_flag, EQ, 4
		
				/NUMBER, -1   ! nothing
		
			*ELSE
		*ENDIF
	
		!-------------------------------------------------------
		
		*IF, show_flag, EQ, 1, THEN  ! plot segment areas
		
				/PNUM, LINE, 0
				/PNUM, AREA, 1
				/PNUM, VOLU, 0
				/PNUM, NODE, 0
				/PNUM, TABN, 0
				/PNUM, SVAL, 0
				/PNUM, ELEM, 0
				/PNUM, KP, 0
				APLOT
		
			*ELSEIF, show_flag, EQ, 2   ! plot segment lines

				LSLA,S
				/PNUM, LINE, 1
				/PNUM, AREA, 0
				/PNUM, VOLU, 0
				/PNUM, NODE, 0
				/PNUM, TABN, 0
				/PNUM, SVAL, 0
				/PNUM, ELEM, 0
				/PNUM, KP, 0
				LPLOT
		
			*ELSEIF, show_flag, EQ, 3   ! plot segment kpoints

				LSLA,S
				KSLL,S
				/PNUM, LINE, 0
				/PNUM, AREA, 0
				/PNUM, VOLU, 0
				/PNUM, NODE, 0
				/PNUM, TABN, 0
				/PNUM, SVAL, 0
				/PNUM, ELEM, 0
				/PNUM, KP, 1
				KPLOT

			*ELSE
		*ENDIF

	*ELSE
*ENDIF

!====================================================================
*IF, Laddmin_1, NE, 0, THEN
LSEL,ALL
		*IF, Laddmax_1, NE, 0, THEN
				LSEL, S, LINE, , Laddmin_1, Laddmax_1, Laddinc_1
			*ELSEIF, Laddmax_1, EQ, 0
				LSEL, S, LINE, , Laddmin_1
			*ELSE
		*ENDIF
		
		*IF, Laddmin_2, NE, 0, THEN
			*IF, Laddmax_2, NE, 0, THEN
					LSEL, A, LINE, , Laddmin_2, Laddmax_2, Laddinc_2
				*ELSEIF, Laddmax_2, EQ, 0
					LSEL, A, LINE, , Laddmin_2
				*ELSE
			*ENDIF
		*ENDIF

		*IF, Laddmin_3, NE, 0, THEN
			*IF, Laddmax_3, NE, 0, THEN
					LSEL, A, LINE, , Laddmin_3, Laddmax_3, Laddinc_3
				*ELSEIF, Laddmax_3, EQ, 0
					LSEL, A, LINE, , Laddmin_3
				*ELSE
			*ENDIF
		*ENDIF

		/PNUM, LINE, 1
		/PNUM, AREA, 0
		/PNUM, VOLU, 0
		/PNUM, NODE, 0
		/PNUM, TABN, 0
		/PNUM, SVAL, 0
		/PNUM, ELEM, 0
		/PNUM, KP, 1
		/NUMBER, 0      ! number + color
		LPLOT

		*IF, ADD_flag, EQ, 1, THEN		
				LCOMB, ALL, , 0		
		*ENDIF
	
	*ELSE
*ENDIF