

;=====================================================================================================================================================
;																									
;	( PIEL-07 )	 		GRAFICA LOGARIZMICA (DISTANCIA INTERSECCION TANGENTES A CENTRO TRAZA)									
;																									
;																									
;					** SPLINES-PLANAS ** ABIERTAS ** en PLANOS NO PARALELOS **											
;																									
;					(SPLI-X)    Divide (MODU) (SPLINE-A) (SPLINE-B) => Puntos ( LIS-PA ) ( LIS-PB )							
;																									
;					(TRAZA-AB)  INTERSECCION PLANOS SPLINE-A SPLINE-B => (TRAZ-1) (TRAZ-2)									
;																									
;					(P-LIMITE)  PUNTOS LIMITE DE TRAMOS ENTRE INFINITOS => Puntos (LIS-InfiA) (LIS-InfiB)						
;																									
;					(LIS-PARES) EMPAREJA PUNTOS LIMITE-INFINITO DE (A) y (B) PARA FORMAR TRAMOS FUERA DEL INFINITO => (LIS-PARES)		
;																									
;					FORMA LISTAS A y B de Nş de ORDEN ( LISTA-NşA  LISTA-NşB ) POR TRAMOS FUERA DEL INFINITO						
;																									
;					DETERMINA GENERATRICES POR TRAMO con (TANGENTE a ARCO OSCULADOR * 3P * desde INTER-TRAZA PPA22) ???				
;																									

;																									
;																									
;=====================================================================================================================================================



;=====================================================================================================================================================
;																									
;									*** ***  SUB-PROGRAMAS  *** ***											
;																									
;=====================================================================================================================================================

;																									
;	SPLINE-X   GRADUA (0.01) => ( LIS-PX )  																		

	(DEFUN SPLI-X ( / )

		(SETQ ALIS  (ENTGET NX00))  									; lista Spline A
		(SETQ AELE  (ASSOC 10 ALIS))  								; 1ş Punto Asociado a 10 (10.punto)
		(SETQ AELES (MEMBER AELE ALIS)) 								; lista a partir del Alterior (10.punto)....(11.punto)
		(SETQ X-primer (CDR (NTH 0 AELES))) 							; primer elemento (10.punto)
		(SETQ X-ultimo (CDR (NTH (- (LENGTH AELES) 1) AELES)))				; ultimo elemento (11.punto)
		(COMMAND "COLOR" COLO "TEXTO" X-primer 0.2 90 TEX)					; TEXTO = A
		(COMMAND "PUNTO" X-primer)									; PINTA 1Ş punto A
		(SETQ N-enti-A1 (ENTLAST))									; nombre ultima entidad principal 1ş punto A
		(COMMAND "DIVIDE" NX00 MODU)									; Divide SPLI-A
		(COMMAND "PUNTO" X-ultimo)									; PINTA Ultimo Punto A
	
		;	PUNTOS SECCION-A (PA1-PAn) =>   LIS-PX  Lon-LPA															
		(SETQ LIS-PX nil)											; LISTA  PUNTOS-A
		(SETQ LIS-PX (CONS (CDR (ASSOC 10 (ENTGET N-enti-A1))) LIS-PX))			; lista entidad -> (1ş Punto-A)
		(SETQ W1A T)
		(WHILE W1A
			(SETQ N-enti-A2 (ENTNEXT N-enti-A1))						; Nombre entidad siguiente
			(COMMAND "BORRA" N-enti-A1 "")
			(IF (= N-enti-A2 nil)  (SETQ W1A nil)
				(PROGN
					(SETQ LIS-PX (CONS (CDR (ASSOC 10 (ENTGET N-enti-A2))) LIS-PX))
					(SETQ N-enti-A1  N-enti-A2 )
				);progn
			);if
		) ;While W1A
		;	LISTA ( LIS-PX )																				
		(SETQ LIS-PX  (REVERSE LIS-PX))
		(SETQ NşPX (LENGTH LIS-PX))			; LIS-PX = 175+1 =

		;	LISTA ( LIS-PX )																				


		;	PINTA PUNTOS LIS-PX (COMPROVACION)																
	  
		(SETQ N1 -1 )
		(REPEAT (LENGTH LIS-PX)
			(SETQ N1 (+ N1 1))
			(SETQ PAAn (NTH N1 LIS-PX))
			(COMMAND "COLOR" COLO "PUNTO" PAAn  "TEXTO" PAAn 0.03 90 N1)
		) ; repeat

		;																							

	) ; Defun SPLI-X

;																									



;																									
;	Puntos ** TRAZA ** de PLANOS de Secciones (A) y (B) => (TRAZ-1) (TRAZ-2)												

	(DEFUN TRAZA-AB ( / )

		(COMMAND "SCP" "B" NA00 )		; PLANO S-a
 			(SETQ Sa0 (TRANS (LIST    0   0 0) 1 0))
 			(SETQ Sa1 (TRANS (LIST  100 100 0) 1 0))
 			(SETQ Sa2 (TRANS (LIST -100 100 0) 1 0))
		(COMMAND "SCP" "U")

		(COMMAND "SCP" "B" NB00 )		; PLANO S-b
 			(SETQ Sa0b (TRANS Sa0 0 1))
 			(SETQ Sa1b (TRANS Sa1 0 1))
 			(SETQ Sa2b (TRANS Sa2 0 1))
 			(SETQ Sb0 (TRANS (LIST (CAR Sa0b) (CADR Sa0b) 0) 1 0))
 			(SETQ Sb1 (TRANS (LIST (CAR Sa1b) (CADR Sa1b) 0) 1 0))
 			(SETQ Sb2 (TRANS (LIST (CAR Sa2b) (CADR Sa2b) 0) 1 0))
		(COMMAND "SCP" "U")


		(SETQ TRAZ-1  (INTERS Sa0 Sa1 Sb0 Sb1 nil))
		(SETQ TRAZ-2  (INTERS Sa0 Sa2 Sb0 Sb2 nil))

		(SETQ TRAZ-12 (LIST 	(+ (CAR   TRAZ-2) (/ (- (CAR   TRAZ-1) (CAR   TRAZ-2)) 2 ))
						(+ (CADR  TRAZ-2) (/ (- (CADR  TRAZ-1) (CADR  TRAZ-2)) 2 ))
						(+ (CADDR TRAZ-2) (/ (- (CADDR TRAZ-1) (CADDR TRAZ-2)) 2 )) ) )

			(COMMAND "COLOR" 7 "LINEA" TRAZ-1 TRAZ-2 "" )

	) ; Defun TRAZA-AB

;																									



;	PUNTOS LIMITE DE TRAMOS ENTRE INFINITOS																		

	(DEFUN P-LIMITE ( / )

		(COMMAND "SCP" "3P" TRAZ-12 TRAZ-1 (NTH 0 LIS-Po) )								; PLANO TRAZ-SPLINE-X

			(SETQ LIS-InfiX nil)
			(SETQ Nff -1 )
			(REPEAT (LENGTH LIS-Po)											; *** REPEAT LIS-Po

				(SETQ Nff (+ Nff 1))
				(SETQ Pf0 (NTH (REM (+ Nff 0) (LENGTH LIS-Po)) LIS-Po))					; PUNTO Nff+0
				(SETQ Pf1 (NTH (REM (+ Nff 1) (LENGTH LIS-Po)) LIS-Po))					;   "   Nff+1
				(SETQ Pf2 (NTH (REM (+ Nff 2) (LENGTH LIS-Po)) LIS-Po))					;   "   Nff+2

				(SETQ Pf0t (TRANS Pf0 0 1))										; PUNTO Nff+0 PLANO TRAZ-A 
				(SETQ Pf1t (TRANS Pf1 0 1))										;   "   Nff+1   "     "    
				(SETQ Pf2t (TRANS Pf2 0 1))										;   "   Nff+2   "     "    

				(SETQ Ag01 (ANGLE Pf0t Pf1t ))
				(SETQ Ag12 (ANGLE Pf1t Pf2t ))

				(COND
					( (AND (< 0  Ag01      PI ) 	(< PI Ag12 (* 2 PI)))
					 	(COMMAND "COLOR" 7 "CIRCULO" Pf1t 0.05)  (SETQ LIS-InfiX (CONS (LIST (+ Nff 1) 'ARR  Pf1 ) LIS-InfiX)) )

					( (AND (< PI Ag01 (* 2 PI)) 	(< 0  Ag12      PI ))
					 	(COMMAND "COLOR" 9 "CIRCULO" Pf1t 0.05)  (SETQ LIS-InfiX (CONS (LIST (+ Nff 1) 'ABA  Pf1 ) LIS-InfiX)) )
				) ;cond

			  
			) ; repeat
 
		(COMMAND "SCP" "U")
 
		(SETQ LIS-InfiX (REVERSE LIS-InfiX))				;  (LENGTH LIS-InfiX)

	) ; Defun P-LIMITE

;																									





;=====================================================================================================================================================
;=====================================================================================================================================================
;																									
;	  *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA ***		
;																									
;=====================================================================================================================================================
;=====================================================================================================================================================

(DEFUN C:PIEL-07 (/ )
  
	;	ARRANCANDO																						
	(SETVAR "blipmode" 0) (SETVAR "cmdecho" 0) (GRAPHSCR) (COMMAND "-REFENT" "DES"  "SCP" "U"  "ORTO" "DES")

	;	NOMBRE DE CAPAS																					

	;(SETQ NşCapa  (GETINT " NOMBRE de CAPA (461 ?) = ")) (TERPRI)		; Nş NOMBRE DE 1Ş CAPA
	;(SETQ NşCapa (- NşCapa 1))
	;(SETQ Wca T)

	;(WHILE Wca

		;(SETQ NşCapa (+ NşCapa 1))
		;(COMMAND "CAPA" "E" NşCapa "") 										; crea y activa capa NşCapa

		;	SELECCCION DE SECCIONES																			
  
		(TERPRI) (SETQ NA00  (CAR (ENTSEL" MARCA --- SPLINE ABIERTA-3D --- SECCION-A ? "))) 	; nombre Spline A 
		(TERPRI) (SETQ NB00  (CAR (ENTSEL" MARCA --- SPLINE ABIERTA-3D --- SECCION-B ? "))) 	; nombre Spline B 

		;-----------------------------------------------------------------------------------------------------------------------------------------
		;	FIJA PARAMETROS																				

		(SETQ MODU   (FIX (/ 35.0  0.2)) )						; Nş de Partes de DIVIDE ( Long-Spline / 0.2 ) = 175 

		;-----------------------------------------------------------------------------------------------------------------------------------------


		;																							
		;	CALCULOS																					

		(TERPRI) (SETQ NX00 NA00  COLO 1 TEX "A" )  (SPLI-X)  (SETQ LIS-PA LIS-PX)	; Divide (SPLINE-A) => Puntos ( LIS-PA )
		(TERPRI) (SETQ NX00 NB00  COLO 5 TEX "B" )  (SPLI-X)  (SETQ LIS-PB LIS-PX)	; Divide (SPLINE-B) => Puntos ( LIS-PB )

		(TRAZA-AB)											; INTERSECCION PLANOS SPLINE-A SPLINE-B => (TRAZ-1) (TRAZ-2)

		(SETQ LIS-Po LIS-PA) (P-LIMITE) (SETQ LIS-InfiA LIS-InfiX)			; PUNTOS LIMITE DE TRAMOS ENTRE INFINITOS => Puntos ( LIS-InfiA )
		(SETQ LIS-Po LIS-PB) (P-LIMITE) (SETQ LIS-InfiB LIS-InfiX)			; PUNTOS LIMITE DE TRAMOS ENTRE INFINITOS => Puntos ( LIS-InfiB )

		;																							

			; REFERENCIA (COMPROVACION)

			'LIS-InfiA (QUOTE ((50 ABA ) (85 ARR ) (88 ABA ) (90 ARR ) (125 ABA ) (176 ARR )))
			'LIS-InfiB (QUOTE ((51 ABA )                     (91 ARR ) (124 ABA ) (175 ARR )))

			'LIS-PARES (QUOTE ((50 51)   (85 nil)  (88 nil)  (90 91)   (125 124)  (176 175)))

		;	EMPAREJA PUNTOS LIMITE-INFINITO DE (A) y (B) PARA FORMAR TRAMOS FUERA DEL INFINITO => (LIS-PARES)						

  		(SETQ LIS-PARES nil)
		(SETQ N6 -1)
		(REPEAT (LENGTH LIS-InfiA)
			(SETQ N6 (+ N6 1))

			(SETQ PfA (NTH N6 LIS-InfiA))				;  ( (+ Nff 1) 'ABA  Pf1 )
			(SETQ QA1 (CAR   PfA))
			(SETQ QA2 (CADR  PfA))
			(SETQ QA3 (CADDR PfA))

			(SETQ DIS-Q 10000)
			(SETQ QA1m nil)
			(SETQ QB1m nil)
			(SETQ N7 -1)
			(REPEAT (LENGTH LIS-InfiB)
				(SETQ N7 (+ N7 1))

				(SETQ PfB (NTH N7 LIS-InfiB))			;  ( (+ Nff 1) 'ABA  Pf1 )
				(SETQ QB1 (CAR   PfB))
				(SETQ QB2 (CADR  PfB))
				(SETQ QB3 (CADDR PfB))

				(COND
					( (AND (< (DISTANCE QA3 QB3) DIS-Q ) (= QA2 QB2) )  (SETQ  DIS-Q (DISTANCE QA3 QB3)  QA1m QA1  QB1m QB1) )
				) ;cond
			) ;repeat

			(COND
				( (> (ABS (- QA1m QB1m)) 3)  (SETQ LIS-PARES (CONS (LIST QA1m  nil ) LIS-PARES)) )
				( (< (ABS (- QA1m QB1m)) 3)  (SETQ LIS-PARES (CONS (LIST QA1m QB1m ) LIS-PARES)) )
			) ;cond
		) ;repeat
  
		(SETQ LIS-PARES (REVERSE LIS-PARES))						    ; ( (50 51) (85 nil) (88 nil) (90 91) (125 124) (176 175) )

		(SETQ LIS-PARES (CONS (NTH (- (LENGTH LIS-PARES) 1) LIS-PARES) LIS-PARES))	; AÑADE AL PRINCIPIO EL ULTIMO ( LIS-PARES )

													; ( (176 175) (50 51) (85 nil) (88 nil) (90 91) (125 124) (176 175) )

		;	PINTA LINEA ENTRE PARES (COMPROVACION)																
		(SETQ N7 -1)
		(REPEAT (LENGTH LIS-PARES)
			(SETQ N7 (+ N7 1))
			(SETQ P7 (NTH N7 LIS-PARES))				;  ( QA1m QB1m )
			(SETQ P7A (CAR   P7))
			(SETQ P7B (CADR  P7))
			(IF (/= P7B nil)

				(COMMAND "COLOR" 7 "LINEA" (NTH (REM P7A (LENGTH LIS-PA)) LIS-PA) (NTH (REM P7B (LENGTH LIS-PB)) LIS-PB) "")

			) ;if
		) ;repeat
		;																							


		;	FORMA LISTAS A y B de Nş de ORDEN ( LISTA-NşA  LISTA-NşB ) POR TRAMOS FUERA DEL INFINITO								

		(SETQ N8 -1)
		(REPEAT 1				;	(- (LENGTH LIS-PARES) 1)		   ; N8   0   1   2   3   4   5   6
			(SETQ N8 (+ N8 1))
			(SETQ P8A   (REM (CAR  (NTH    N8    LIS-PARES)) (LENGTH LIS-PA)) )	;   0  50  85  88  90 125   0
			(SETQ P8A+1 (REM (CAR  (NTH (+ N8 1) LIS-PARES)) (LENGTH LIS-PA)) )	;  50  85  88  90 125   0   0

			(SETQ P8B   (REM (CADR (NTH    N8    LIS-PARES)) (LENGTH LIS-PB)) )	; 175  51 nil nil  91 124 175
			(SETQ P8B+1 (REM (CADR (NTH (+ N8 1) LIS-PARES)) (LENGTH LIS-PB)) )	;  51 nil nil  91 124 175 175		REM żż nil ??
		  
			; LIS-PARES = ((176 175) (50 51) (85 nil) (88 nil) (90 91) (125 124) (176 175))

			(SETQ LIS-NşA-1 nil) 
		  	(SETQ N9 (- P8A 1))
			(REPEAT (+ (- P8A+1 P8A) 1)

				(SETQ N9 (+ N9 1))
				(SETQ LIS-NşA-1 (CONS N9 LIS-NşA-1))
			) ;repeat
			(SETQ LIS-NşA-1 (REVERSE LIS-NşA-1))   	; (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
		  								; 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50)
			(SETQ LIS-NşB-1 nil) 
		  	(SETQ N10 (- P8B 1))
			(REPEAT (+ P8B+1 2)	; truco (mal)  ??????????????????????????????????????????????     ż nil ?

				(SETQ N10 (+ N10 1))
				(SETQ N100 (REM N10 (LENGTH LIS-PB)) )

				(SETQ LIS-NşB-1 (CONS N100 LIS-NşB-1))
			) ;repeat
			(SETQ LIS-NşB-1 (REVERSE LIS-NşB-1))	; (175 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
		  								; 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51)
		) ;repeat

		;																							



		;	DETERMINA GENERATRICES POR TRAMO con (TANGENTE a CIRCULO OSCULADOR desde INTER-TRAZA)	???							


		(COMMAND "SCP" "B" NB00 )											; PLANO SPLINE-B 

		(COMMAND "CAPA" "DES" (CDR (ASSOC 8 ALIS)) "") 								; DESCONECTA CAPA SPLINES por "LINEA" "TAN"

		(SETQ NNşa  0 )
		(SETQ Waa   T )

		(WHILE Waa

			(SETQ NNşa (+ NNşa 1))

			(IF (= (NTH (+ NNşa 1) LIS-NşA-1) nil)  (SETQ Waa nil)
			(PROGN

				(SETQ PPA1  (NTH (NTH (- NNşa 1) LIS-NşA-1) LIS-PA))  				; LIS-NşA-1 = 51 
				(SETQ PPA2  (NTH (NTH (+ NNşa 0) LIS-NşA-1) LIS-PA))
				(SETQ PPA3  (NTH (NTH (+ NNşa 1) LIS-NşA-1) LIS-PA))


				;	TAG en PPA2 = ( PPA2 PPA22 ) Paralela a ( PPA1 PPA3 )			

				(SETQ PPA22 (LIST
						 	(+ (CAR   PPA2) (- (CAR   PPA3) (CAR   PPA1) ))
						 	(+ (CADR  PPA2) (- (CADR  PPA3) (CADR  PPA1) ))
						 	(+ (CADDR PPA2) (- (CADDR PPA3) (CADDR PPA1) )) ))

				(SETQ IN-TraA nil)

				(SETQ IN-TraA (INTERS PPA2 PPA22  TRAZ-1 TRAZ-2 nil))				; SCU 

				(IF (/= IN-TraA nil)
				(PROGN

 					(SETQ PPA2-b    (TRANS PPA2    0 1))						; Puntos TAG-A
 					(SETQ IN-TraA-b (TRANS IN-TraA 0 1))						; SCP 

					(SETQ TTAA nil )
					(SETQ TTBB nil )

					(SETQ DISm 100000.0)
					(SETQ NNşb  0 )
					(SETQ Wbb   T )

					(WHILE Wbb

						(SETQ NNşb (+ NNşb 1))

						(IF (= (NTH (+ NNşb 1) LIS-NşB-1) nil)  (SETQ Wbb nil)
						(PROGN

							(SETQ PPB1  (NTH (NTH (- NNşb 1) LIS-NşB-1) LIS-PB))		; LIS-NşB-1 = 53 
							(SETQ PPB2  (NTH (NTH (+ NNşb 0) LIS-NşB-1) LIS-PB))
							(SETQ PPB3  (NTH (NTH (+ NNşb 1) LIS-NşB-1) LIS-PB))

 							(SETQ PPB1-b  (TRANS PPB1 0 1))
 							(SETQ PPB2-b  (TRANS PPB2 0 1))
 							(SETQ PPB3-b  (TRANS PPB3 0 1))

							;	PUNTO MEDIO	*											

							(SETQ PB12Mb  (LIST	(+ (CAR   PPB1-b) (/ (- (CAR   PPB2-b) (CAR   PPB1-b)) 2))
											(+ (CADR  PPB1-b) (/ (- (CADR  PPB2-b) (CADR  PPB1-b)) 2))))
							(SETQ PB23Mb  (LIST	(+ (CAR   PPB2-b) (/ (- (CAR   PPB3-b) (CAR   PPB2-b)) 2))
											(+ (CADR  PPB2-b) (/ (- (CADR  PPB3-b) (CADR  PPB2-B)) 2))))

							;	PERPENDICULAR AL PUNTO MEDIO **								

							(SETQ PB12Pb (LIST
								(+ (+ (CAR  PPB1-b) (/ (- (CAR  PPB2-b) (CAR  PPB1-b)) 2)) (/ (- (CADR PPB2-b) (CADR PPB1-b)) 2))
								(- (+ (CADR PPB1-b) (/ (- (CADR PPB2-b) (CADR PPB1-b)) 2)) (/ (- (CAR  PPB2-b) (CAR  PPB1-b)) 2))))

							(SETQ PB23Pb (LIST
								(+ (+ (CAR  PPB2-b) (/ (- (CAR  PPB3-b) (CAR  PPB2-b)) 2)) (/ (- (CADR PPB3-b) (CADR PPB2-b)) 2))
								(- (+ (CADR PPB2-b) (/ (- (CADR PPB3-b) (CADR PPB2-b)) 2)) (/ (- (CAR  PPB3-b) (CAR  PPB2-b)) 2))))

							;	INTERSECCION PERPENDICULARES Medias (CENTRO CIRCULO OSCULADOR)			

 							(SETQ PB12MU   (TRANS PB12Mb 1 0))
 							(SETQ PB23MU   (TRANS PB23Mb 1 0))
 							(SETQ PB12PU   (TRANS PB12Pb 1 0))
 							(SETQ PB23PU   (TRANS PB23Pb 1 0))

							(SETQ IN-B123*U nil)

							(SETQ IN-B123*U (INTERS PB12MU PB12PU  PB23MU PB23PU nil))	; SCU

							(IF (/= IN-B123*U nil)
							(PROGN

 								(SETQ IN-B123*b (TRANS IN-B123*U 0 1))			; SCP 


								(COMMAND "COLOR" 1 "LINEA" IN-B123*b PB12Mb "")
								(COMMAND "COLOR" 1 "LINEA" IN-B123*b PB23Mb "")






							  
								;	ARCOS COMCENTRICOS										

								(SETQ Narco   nil )
								(SETQ NlineaT nil )

								(COND
									( (< (- (ANGLE PPB3-b PPB1-b) (ANGLE PPB3-b PPB2-b)) 0)

										(COMMAND "COLOR" 255 "ARCO" "C" IN-B123*b PB12Mb PB23Mb) (SETQ Narco  (ENTLAST))
										(COND ( (/= Narco nil)
									 		(COMMAND "COLOR" 3 "LINEA" "TAN" PB12Mb IN-TraA-b "" )
									 		(SETQ NlineaT (ENTLAST)) )) )

									( (> (- (ANGLE PPB3-b PPB1-b) (ANGLE PPB3-b PPB2-b)) 0)

										(COMMAND "COLOR" 255 "ARCO" "C" IN-B123*b PB23Mb PB12Mb) (SETQ Narco  (ENTLAST))
										(COND ( (/= Narco nil)
									 		(COMMAND "COLOR" 3 "LINEA" "TAN" PB23Mb IN-TraA-b "" )
									 		(SETQ NlineaT (ENTLAST)) )) )
								) ;cond

								;	TANGENTE IMPOSIBLE:   PUNTO DENTRO CIRCULO o CIRCUNFERENCIA FUERA del ARCO	

								;(IF (/= Narco nil)
								;(PROGN
									;(SETQ NlineaT nil )
									;(COMMAND "COLOR" 3 "LINEA" "TAN" PB12Mb IN-TraA-b "" )   (SETQ NlineaT (ENTLAST))

									(IF (/= NlineaT nil)
									(PROGN
										(SETQ P-TaG-b  (TRANS (CDR (ASSOC 10 (ENTGET NlineaT))) 0 1)) ; SCP 
										(SETQ P-Tag           (CDR (ASSOC 10 (ENTGET NlineaT)))     ) ; SCU 

										(SETQ DISab (DISTANCE PPA2 PPB2))

										(IF (< DISab DISm)
										(PROGN
											(SETQ DISm  DISab )
											(SETQ TTAA  PPA2-b    )
											(SETQ TTBB  P-TaG-b   )
											(SETQ TTBB*  P-TaG   )


											(PROMPT "   Na= ") (PRIN1 (NTH (+ NNşa 0) LIS-NşA-1))
											(PROMPT "   Nb= ") (PRIN1 (NTH (+ NNşb 0) LIS-NşB-1))
											(PROMPT "   Zt= ") (PRIN1 (CADDR TTBB))






; PLATALLA LISP	
(QUOTE (
	  200
	   -4.87501201
	   -5.4224202
	   -4.81556203
	   -5.06642204
	   -5.21338205
	   -5.21405206
	   -5.22372207
	   -5.27098208
	   -5.31821209
	   -5.370932010
	   -5.425892011
	   -5.465942012
	   -5.482572013
	   -5.500472014
	   -5.561312015
	   -5.611192016
	   -5.630832017
	   -5.619982018
	   -2.13163e-0142019
	   -5.696812020
	   -5.882012021
	   -6.710142022
	   -3.30063
))


; PLATALLA TEXTO	
(QUOTE (
						Tangente imposible
 Na= 20 Nb=  0 Zt= -4.87501		Tangente imposible
 Na= 20 Nb=  1 Zt= -5.4224		Tangente imposible
 Na= 20 Nb=  2 Zt= -4.81556		Tangente imposible
 Na= 20 Nb=  3 Zt= -5.06642		Tangente imposible
 Na= 20 Nb=  4 Zt= -5.21338		Tangente imposible
 Na= 20 Nb=  5 Zt= -5.21405		Tangente imposible
 Na= 20 Nb=  6 Zt= -5.22372		Tangente imposible
 Na= 20 Nb=  7 Zt= -5.27098		Tangente imposible
 Na= 20 Nb=  8 Zt= -5.31821		Tangente imposible
 Na= 20 Nb=  9 Zt= -5.37093		Tangente imposible
 Na= 20 Nb= 10 Zt= -5.42589		Tangente imposible
 Na= 20 Nb= 11 Zt= -5.46594		Tangente imposible
 Na= 20 Nb= 12 Zt= -5.48257		Tangente imposible
 Na= 20 Nb= 13 Zt= -5.50047		Tangente imposible
 Na= 20 Nb= 14 Zt= -5.56131		Tangente imposible
 Na= 20 Nb= 15 Zt= -5.61119		Tangente imposible
 Na= 20 Nb= 16 Zt= -5.63083		Tangente imposible
 Na= 20 Nb= 17 Zt= -5.61998
 Na= 20 Nb= 18 Zt= -2.13163e-014	Tangente imposible
 Na= 20 Nb= 19 Zt= -5.69681		Tangente imposible
 Na= 20 Nb= 20 Zt= -5.88201		Tangente imposible
 Na= 20 Nb= 21 Zt= -6.71014		Tangente imposible
 Na= 20 Nb= 22 Zt= -3.30063		Tangente imposible

						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible
						Tangente imposible   
))







										  

											;(SETQ NNBB  NNşb      )
										) ;progn
										) ;if DISab

										;(COMMAND "BORRA" Narco   "")
										;(COMMAND "BORRA" NlineaT "")
									  
									) ;progn
									) ;if NlineaT
								;) ;progn
								;) ;if Narco
							) ;progn
							) ;if IN-B123*U
						) ;progn
						) ;if NNşb
					) ;while wbb

					(TERPRI)

				;	(IF (AND (/= TTAA nil) (/= TTBB nil) (EQUAL (CADDR TTBB) 0 0.00001)) ;ERROR (CADDR TTBB) NO SIEMPRE ES CERO ?????????

					(IF (AND (/= TTAA nil) (/= TTBB nil) )  ;ERROR (CADDR TTBB) NO SIEMPRE ES CERO ?????????

					(PROGN
						(COMMAND "COLOR" 2 "LINEA" TTAA TTBB "")
						(COMMAND "COLOR" 1 "LINEA" TTAA IN-TraA-b "" ) 
						(COMMAND "COLOR" 4 "LINEA" TTBB IN-TraA-b "" ) 

					) ;progn
					) ;if TTAA
				) ;progn
				) ;if IN-TraA
			) ;progn
			) ;if NNşa
		) ;while Waa

	(COMMAND "SCP" "U")

	;																								


	;	(TERPRI) (TERPRI) 
	;	(SETQ NW1 (GETSTRING "QUIERE SEGUIR (S) o N : "))
	;	(IF (EQUAL NW1 "N") (SETQ Wca nil) (SETQ Wca T))

	;) ;CIERRE WHILE Wca
  
	;																								

	;	PARANDO																						
	(SETVAR "blipmode" 1) (SETVAR "cmdecho" 1)
) ;CIERRE DEFUN PIEL-07
;=====================================================================================================================================================



