

;-------------------------------------------------------------------------------------------------------------------------------------
;																																																																			
;	( ESCULTURA-NUDO-03 )                                                                 														28/06/2008				
;																																																																			
;=====================================================================================================================================
;																																																																			
; 		SECCION INICIO: POLIGUNO REGULAR  ( NšLados )																																						        
;																																																																			
;			Genera 3DCARAS-PLANAS entre POLIGONOS de LADOS TANGENTES a CIRCULOS (RADIO) en PLANO NORMAL a (P2 P3) en PUNTO MEDIO (P23u)			
;																																																																			
;			SPLINE CAMINO: CURVA-3D  PUNTEADA con DIVIDE (NšDiv) => P1 P2 P3 .........																										  
;																																																																			
;			SPLINE PERFIL: SPLINE CURVA-2D  DETERMINA PERFIL DEL CUERPO (PRINCIPIO y FIN en VERTICAL de SPLINE EJE)													
;			SPLINE EJE   : SPLINE RECTA HORIZONTAL (PRINCIPIO y FIN en VERTICAL de SPLINE PERFIL)																						
;																																																																			
;			CIRCULOS de RADIO VARIABLE (RADIO) Generados por DIFERENCIA = Y entre (Spline PERFIL) y (Spline EJE)														
;																																																																			
;			PINTA PATRONES y LINEA-GEODESICA (CREMALLERA)																																		                
;																																																																			




;-------------------------------------------------------------------------------------------------------------------------------------
;	(01)	(PUNTOS-DIVIDE) = PUNTEA SPLINE a NšDIVISIONES ( N-ELE ) + ( NšDIDI ) => ( LIS-PUNTOS )																				
;-------------------------------------------------------------------------------------------------------------------------------------

(DEFUN PUNTOS-DIVIDE (/  )

	(SETQ LIS-PUNTOS  nil)

	(SETQ   Elen (MEMBER (ASSOC 10 (ENTGET N-ELE)) (ENTGET N-ELE))									; lista a partir del elemento (incluido)
		    P-1š    (CDR (NTH      0              Elen))												      ; primer elemento
		    P-Uo    (CDR (NTH (- (LENGTH Elen) 1) Elen)) )												    ; ultimo elemento

	(COMMAND  "COLOR" 1 "PUNTO"  P-1š)																		          ; PINTA Primer Punto (en Base de Datos)
 	(SETQ  N-1šP (ENTLAST))																						              ; Nombre ultima entidad principal = 1š punto
	(COMMAND	 "COLOR" 7 "DIVIDE" N-ELE NšDIDI																      ; PINTA Punto Divide (en Base de Datos)
			     "COLOR" 5 "PUNTO"  P-Uo       )															          ; PINTA Ultimo Punto (en Base de Datos)

	;	PUNTOS SECCION X (PX1-PXn) =>  LIS-PUNTOS																																													

	(SETQ  N-P1         nil
		   	N-P2         nil
		   	N-P2         N-1šP
		   	LIS-PUNTOS   nil
		   	LIS-PUNTOS  (LIST (CDR (ASSOC 10 (ENTGET N-1šP))))											   ; LIS-PUNTOS => 1š punto
		   	WW           T )

	(WHILE WW
	  (SETQ N-P1 (ENTNEXT N-1šP))																			         		  ; nombre entidad siguiente
				
		(IF (= N-P1 nil)	(SETQ WW nil)
			(PROGN
				(SETQ LIS-PUNTOS (CONS (CDR (ASSOC 10 (ENTGET N-P1))) LIS-PUNTOS))				; LIS-PUNTOS => Resto PUNTOS con ULTIMO
				(SETQ  N-1šP N-P1 )
				(ENTDEL N-P1)																		; BORRA PUNTO N-P1 
			) ; pro
		) ; if 
	) ; whi
	(SETQ LIS-PUNTOS (REVERSE LIS-PUNTOS))
	(ENTDEL N-P2)																					; BORRA PUNTO N-P2 

) ;	(01)  DEFUN   PUNTOS-DIVIDE 

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

;-------------------------------------------------------------------------------------------------------------------------------------
;	(02) CALCULOS  PERFIL RADIOS ( RADIO ) CIRCULOS a TANGENTES por SPLINE	SPLINE-REF ----- DIVIDIR NšDiv*3 => LIS-Pun-REF => PP1 PP2	
;																		                                      SPLINE-EJE ----- DIVIDIR NšDiv   => LIS-Pun-EJE => PPb	    
;-------------------------------------------------------------------------------------------------------------------------------------

(DEFUN LISTA-RADIOS-PERFIL (/  )

  (SETQ LIS-RADI nil)
	(SETQ NšEje -1)
	(SETQ NšRef -1)

	(REPEAT (LENGTH LIS-Pun-EJE)
		(SETQ NšEje (+ NšEje 1))

		(IF (NOT (= (REM NšEje 2) 0))
			(PROGN
				(SETQ PPb (NTH NšEje LIS-Pun-EJE))  (SETQ XXb (CAR PPb) YYb (CADR PPb))
				(SETQ WW T)
				(WHILE WW
					(SETQ NšRef (+ NšRef 1))
					(SETQ PP1 (NTH (+ NšRef 0) LIS-Pun-REF))  (SETQ XX1 (CAR PP1) YY1 (CADR PP1))
					(SETQ PP2 (NTH (+ NšRef 1) LIS-Pun-REF))  (SETQ XX2 (CAR PP2) YY2 (CADR PP2))

					(IF (AND (<= XX1 XXb) (< XXb XX2))
						(PROGN																																							
							(SETQ R-REF (/ (+ (* (- YY1 YYb) (- XX2 XXb)) (* (- YY2 YYb) (- XXb XX1))) (- XX2 XX1)))
							(SETQ LIS-RADI (CONS R-REF LIS-RADI))											; (LENGTH LIS-RADI)
							(SETQ WW nil)
							(COMMAND "COLOR" 8 "LINEA" PPb (LIST XXb (+ YYb R-REF)) "")
						) ;pro
					) ;if
					(IF (>= NšRef (- (LENGTH LIS-Pun-REF) 2)) (SETQ WW nil))
				) ; Whi NšRef
			) ;pro
		) ; if
	) ; repe NšEje
	(SETQ LIS-RADI (REVERSE LIS-RADI))																		; (NTH 0 LIS-RADI)  (LENGTH LIS-RADI)

) ;	(02)  DEFUN   LISTA-RADIOS-PERFIL 

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


;-------------------------------------------------------------------------------------------------------------------------------------
;	(03)	CALCULO de  LIS-DATOS-SECCIONES ( P12u R12  C123ou C123zu  P23u R23  C234ou C234zu  P34u R34 ) 																
;-------------------------------------------------------------------------------------------------------------------------------------

(DEFUN CALCULO-LIS-DATOS-SECC (/  )


	(SETQ LIS-DATOS-SECCIONES nil)

	(SETQ NšSCP -1 )
	(REPEAT  (- (LENGTH LIS-Pun-CAMI) 3)
		(SETQ NšSCP (+ NšSCP 1))

		(SETQ P1 (NTH (+ NšSCP 0) LIS-Pun-CAMI))   (SETQ X1 (CAR P1) Y1 (CADR P1) Z1 (CADDR P1))
		(SETQ P2 (NTH (+ NšSCP 1) LIS-Pun-CAMI))   (SETQ X2 (CAR P2) Y2 (CADR P2) Z2 (CADDR P2))
		(SETQ P3 (NTH (+ NšSCP 2) LIS-Pun-CAMI))   (SETQ X3 (CAR P3) Y3 (CADR P3) Z3 (CADDR P3))
		(SETQ P4 (NTH (+ NšSCP 3) LIS-Pun-CAMI))   (SETQ X4 (CAR P4) Y4 (CADR P4) Z4 (CADDR P4))

		(IF (OR (AND (EQUAL (/ (- Y2 Y1) (- X2 X1)) (/ (- Y3 Y2) (- X3 X2)) mUNI )
					       (EQUAL (/ (- Z2 Z1) (- X2 X1)) (/ (- Z3 Z2) (- X3 X2)) mUNI ))  ; P1 P2 P3 en LINEA 

			      (AND (EQUAL (/ (- Y3 Y2) (- X3 X2)) (/ (- Y4 Y3) (- X4 X3)) mUNI )
					       (EQUAL (/ (- Z3 Z2) (- X3 X2)) (/ (- Z4 Z3) (- X4 X3)) mUNI ))) ; P2 P3 P4 en LINEA 

			(PROGN 	; (P1 P2 P3) y (P2 P3 P4) NO DEFINEN CIRCULOS 	

				(IF (AND (EQUAL (/ (- Y2 Y1) (- X2 X1)) (/ (- Y3 Y2) (- X3 X2)) mUNI )
					       (EQUAL (/ (- Z2 Z1) (- X2 X1)) (/ (- Z3 Z2) (- X3 X2)) mUNI ))  ; P1 P2 P3 en LINEA 
					(PROGN
						(PROMPT " >>>>>>>>>  NO DEFINEN CIRCULO en LINEA (P1 P2 P3)  NšSCP = ( ")
						(PRIN1 (+ NšSCP 0)) (PROMPT " ") (PRIN1 (+ NšSCP 1)) (PROMPT " ")  (PRIN1 (+ NšSCP 2)) (PROMPT " )")  (TERPRI)
					) ; pro 
				) ; if

				(IF (AND (EQUAL (/ (- Y3 Y2) (- X3 X2)) (/ (- Y4 Y3) (- X4 X3)) mUNI )
					       (EQUAL (/ (- Z3 Z2) (- X3 X2)) (/ (- Z4 Z3) (- X4 X3)) mUNI ))  ; P2 P3 P4 en LINEA 
					(PROGN
						(PROMPT " >>>>>>>>>  NO DEFINEN CIRCULO en LINEA (P2 P3 P4)  NšSCP = ( ")
						(PRIN1 (+ NšSCP 1)) (PROMPT " ") (PRIN1 (+ NšSCP 2)) (PROMPT " ")  (PRIN1 (+ NšSCP 3)) (PROMPT " )")  (TERPRI)
					) ; pro 
				) ; if
			) ; pro 


			(PROGN 	; (P1 P2 P3) y (P2 P3 P4) SI DEFINEN CIRCULOS 	

				; PUNTOS MEDIOS de (P1 P2) (P2 P3) (P3 P4) 																																										

				(SETQ P12u (CAL " PLT( P1 , P2 , 0.5 )"))
				(SETQ P23u (CAL " PLT( P2 , P3 , 0.5 )"))
				(SETQ P34u (CAL " PLT( P3 , P4 , 0.5 )"))

				; CENTRO del CIRCULO-OSCULADOR-AB   P1 P2 P3																																									

				(IF (= (CAL " NOR( P1 , P2 , P3 )") nil)
					(PROGN  (PROMPT " >>> PUNTOS (P1 P2 P3) ALINEADOS  CIR-OSCULA-1   NšSCP = ") (PRIN1 NšSCP) (TERPRI))

					(PROGN  (COMMAND "SCP" "3P" P1 P2 P3 ))						; PLANO PUNTOS => C123ou   para P12u P23u
				) ; if 

					(COMMAND "COLOR" 1  "CIRCULO" "3P" (TRANS P1 0 1) (TRANS P2 0 1) (TRANS P3 0 1))	; CIRCULO-OSCULADOR AB    
					(SETQ   NCi-AB  (ENTLAST))																												; "NCi-AB" NOMBRE CIRCULO-OSCULADOR
					(SETQ    C123ou (TRANS (CDR (ASSOC 10 (ENTGET NCi-AB)))  NCi-AB 0 ))							; CENTRO CIRCULO-OSCULADOR SCU  CHARNELA-0
					(SETQ    CenABp (TRANS (CDR (ASSOC 10 (ENTGET NCi-AB)))  NCi-AB 1 ))							; CENTRO CIRCULO-OSCULADOR SCP-AC
					(SETQ    C123zu (TRANS (LIST (CAR CenABp) (CADR CenABp) 40.0 ) 1   0 ))						; PERPENDICULAR CENTRO CIRCULO-OSCULADOR SCU
					(ENTDEL NCi-AB)																																		; "NCi-AB" BORRA 
				(COMMAND "SCP" "U") 

				; CENTRO del CIRCULO-OSCULADOR-BC   P2 P3 P4																																									

				(IF (= (CAL " NOR( P2 , P3 , P4 )") nil)
					(PROGN  (PROMPT " >>> PUNTOS (P2 P3 P4) ALINEADOS  CIR-OSCULA-2   NšSCP = ") (PRIN1 NšSCP) (TERPRI))

					(PROGN  (COMMAND "SCP" "3P" P2 P3 P4 ))						; PLANO PUNTOS => C234ou   para P23u P34u
				) ; if 

					(COMMAND "COLOR" 2  "CIRCULO" "3P" (TRANS P2 0 1) (TRANS P3 0 1) (TRANS P4 0 1))	; CIRCULO-OSCULADOR AB    
					(SETQ   NCi-BC  (ENTLAST))																												; "NCi-BC" NOMBRE CIRCULO-OSCULADOR
					(SETQ    C234ou (TRANS (CDR (ASSOC 10 (ENTGET NCi-BC)))  NCi-BC 0 ))							; CENTRO CIRCULO-OSCULADOR SCU  CHARNELA-0
					(SETQ    CenBCp (TRANS (CDR (ASSOC 10 (ENTGET NCi-BC)))  NCi-BC 1 ))							; CENTRO CIRCULO-OSCULADOR SCP-AC
					(SETQ    C234zu (TRANS (LIST (CAR CenBCp) (CADR CenBCp) 40.0 ) 1   0 ))						; PERPENDICULAR CENTRO CIRCULO-OSCULADOR SCU
					(ENTDEL NCi-BC)																																		; "NCi-BC" BORRA 
				(COMMAND "SCP" "U") 

				; RADIOS 																																																											

				(SETQ R12 (NTH (+ NšSCP 0) LIS-RADI ))
				(SETQ R23 (NTH (+ NšSCP 1) LIS-RADI ))
				(SETQ R34 (NTH (+ NšSCP 2) LIS-RADI ))

				; LISTA SCP de SECCIONES																																																			
				(SETQ LIS-DATOS-SECCIONES  (CONS  (LIST P12u R12  C123ou C123zu  P23u R23  C234ou C234zu  P34u R34 )  LIS-DATOS-SECCIONES ))

			) ; pro
		) ; if  TRES PUNTOS en LINEA
	) ; repe  LIS-Pun-CAMI 

	(SETQ LIS-DATOS-SECCIONES (REVERSE LIS-DATOS-SECCIONES))   ; (LENGTH LIS-DATOS-SECCIONES ) 

) ;	(03)  DEFUN   CALCULO-LIS-DATOS-SECC 

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



"####################################################################################################################################"
;-------------------------------------------------------------------------------------------------------------------------------------
; *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA *** PROGRAMA 	
;-------------------------------------------------------------------------------------------------------------------------------------
"####################################################################################################################################"

(DEFUN C:ESCULTURA-NUDO-03 ( / )

	;===================================================================================================================================
	;  (00) ARRANCANDO																																																									

 	(SETVAR "blipmode" 0) (SETVAR "cmdecho" 0)  (GRAPHSCR)  (COMMAND "-REFENT" "DES")  (COMMAND "SCP" "U")  (COMMAND "ORTO" "DES")

	(PROMPT " ============================================================================")  (TERPRI)
	(PROMPT " >>>> INICIO >>>>>>>>>>>>>>>>>> ESCULTURA-NUDO-03 >>>>>>>>>>>>>>>>>>>>>>>>>>>")  (TERPRI)
	(PROMPT " ============================================================================")  (TERPRI) (TERPRI)

	(IF (= CAL nil)(COMMAND "ARX" "L" "GEOMCAL.ARX"))		; CARGA CALCULADORA 


	;===================================================================================================================================
	;	(01) FIJAR VARIABLES EN EL PROGRAMA																																																

	      (SETQ NšDiv    100   )										; Nš(DIVIDE)  SPLINE ( AJUSTAS a DISTANCIA SECCIONES a 1 Ud ? )
				(SETQ NšLados   12   )										; Nš de LADOS POLIGONO REGULAR en INICIO 

				(SETQ DesviAg  (* (/ PI 180.0) 0.0 ))			; DESVIACION ANGULO SECCION INICIO 

				(SETQ SEPARA-P  90   )										; SEPARACION ENTRE PATRONES 
				(SETQ AlTex      0.3 )										; ALTURA TEXTO en 3DCARAS 


	      (SETQ mUNI 1.0e-006 )											; MARGEN EQUAL VEC-UNITARIOS (1.01e-008)LIMITE-MAR-INTER-RECT-01.lsp 

	;===================================================================================================================================
	;	(02) TOMA de DATOS en PANTALLA            																																												

 	(SETQ N-CAMI (CAR (ENTSEL "------------------------ MARCA >>>>>>>>>>>>>>>>>  SPLINE - CAMINO ? <<<<<<<<<" ))) (TERPRI)
 	(SETQ N-PERF (CAR (ENTSEL "------------------------ MARCA >>>>>>>>>>>>>>>>>  SPLINE - PERFIL ? <<<<<<<<<" ))) (TERPRI)
 	(SETQ N-BASE (CAR (ENTSEL "------------------------ MARCA >>>>>>>>>>>>>>>>>  SPLINE - EJE    ? <<<<<<<<<" ))) (TERPRI) (TERPRI)

	(PROMPT                   " ****************************************************************************")    (TERPRI)
	(PROMPT                   " ************************** COMENTARIOS y ERRORES ***************************")    (TERPRI) (TERPRI)


	;===================================================================================================================================
	;	(03)	LISTAS PUNTOS ( SPLI-CAMINO   SPLI-PERFIL   SPLI-BASE ) 																																		

	(SETQ  N-ELE N-CAMI   NšDIDI    NšDiv   )  (PUNTOS-DIVIDE)  (SETQ LIS-Pun-CAMI LIS-PUNTOS   P-Ulti  P-Uo)		; (LENGTH LIS-Pun-CAMI) 
	(SETQ  N-ELE N-PERF   NšDIDI (* NšDiv 6))  (PUNTOS-DIVIDE)  (SETQ LIS-Pun-REF  LIS-PUNTOS)							  	; (LENGTH LIS-Pun-REF)  
	(SETQ  N-ELE N-BASE   NšDIDI (* NšDiv 2))  (PUNTOS-DIVIDE)  (SETQ LIS-Pun-EJE  LIS-PUNTOS)									; (LENGTH LIS-Pun-EJE)  

	;===================================================================================================================================
	(LISTA-RADIOS-PERFIL)		  ;	(04) RADIOS CIRCULOS para TANGENTES en SECCCIONES (PERFIL SPLINE)  ( LIS-RADI )  												

	;===================================================================================================================================
	(CALCULO-LIS-DATOS-SECC)	;	(06) CALCULO de LIS-DATOS-SECCIONES ( P12u R12  C123ou C123zu  P23u R23  C234ou C234zu  P34u R34 )			


	"##################################################################################################################################"
	;===================================================================================================================================
	;	(04)  CALCULA TODAS las SECCIONES																																																	
	;===================================================================================================================================

	(SETQ Lis-VER-TODOu nil )
	(SETQ Lis-TAG-TODOu nil )

	(SETQ NšSEC  -1 )
	(REPEAT  (LENGTH LIS-DATOS-SECCIONES )					 						; POR PLANOS  
		(SETQ NšSEC  (+ NšSEC 1))

		(SETQ LIS-DATOS (NTH  NšSEC  LIS-DATOS-SECCIONES))				; ( P12u R12  C123ou C123zu  P23u R23  C234ou C234zu  P34u R34 ) 

		(SETQ P12u      (NTH 0 LIS-DATOS))
		(SETQ R12       (NTH 1 LIS-DATOS))
		(SETQ C123ou    (NTH 2 LIS-DATOS))
		(SETQ C123zu    (NTH 3 LIS-DATOS))
		(SETQ P23u      (NTH 4 LIS-DATOS))
		(SETQ R23       (NTH 5 LIS-DATOS))
		(SETQ C234ou    (NTH 6 LIS-DATOS))
		(SETQ C234zu    (NTH 7 LIS-DATOS))
		(SETQ P34u      (NTH 8 LIS-DATOS))
		(SETQ R34       (NTH 9 LIS-DATOS))

				; COMPRPBACION																																								
				;		(IF (= (REM (+ NšSEC 1) 5) 0 ) (SETQ COLO 5 ) (SETQ COLO (REM (+ NšSEC 1) 5) ))
				;		(COMMAND "COLOR" COLO  "LINEA" P12u   P23u   "")
				;		(COMMAND "COLOR" COLO  "LINEA" C123ou C123zu "")
			  ; ) ; repe
				; COMPRPBACION																																								


		"################################################################################################################################"
		;---------------------------------------------------------------------------------------------------------------------------------
		; (1) PLANO-INICIO  P12-C123oz   ENTRA   SALIR                   		
		;---------------------------------------------------------------------------------------------------------------------------------

		(IF (= NšSEC 0 )
			(PROGN

				; (1) SECCION de REF-INICIO: POLIGONO REGULAR  ( NšLados )	(1šVERTICE en EJE-X + DesviAg )    Lis-VE-12p   Lis-TA-12p						

  			(SETQ Lis-VE-12p nil)
  			(SETQ Lis-TA-12p nil)

				(SETQ RaInc (NTH 0 LIS-RADI ))        (SETQ AgInc (/      PI  NšLados ))						; 1šRADIO y ANGULO CIRCULO INCRITO     
				(SETQ RaCir (/ RaInc (COS AgInc )))	  (SETQ AgCir (/ (* 2 PI) NšLados ))						; 1šRADIO y ANGULO CIRCULO CIRCUNCRITO 

				(SETQ Ag-CC (+ (- AgCir       ) DesviAg ))
				(SETQ Ag-II (+ (- AgInc AgCir ) DesviAg ))
				(REPEAT  NšLados
					(SETQ Ag-CC  (+ Ag-CC  AgCir ))
					(SETQ Ag-II  (+ Ag-II  AgCir ))

					(SETQ V12o_p (LIST (* RaCir (COS Ag-CC)) (* RaCir (SIN Ag-CC)) 0.0 )) (SETQ Lis-VE-12p (CONS  V12o_p  Lis-VE-12p ))	; P-VERTIC 
					(SETQ T12o_p (LIST (* RaInc (COS Ag-II)) (* RaInc (SIN Ag-II)) 0.0 )) (SETQ Lis-TA-12p (CONS  T12o_p  Lis-TA-12p ))	; P-TANGEN 
				) ; repe

				(SETQ Lis-VE-12p (REVERSE Lis-VE-12p ))  ; (LENGTH Lis-VE-12p)
				(SETQ Lis-TA-12p (REVERSE Lis-TA-12p ))  ; (LENGTH Lis-TA-12p)

				; (1) PINTA CIRCULO y LADOS en PLANO-INICIO (P12-C123oz) R12 VER1 TAG1 INT1 ( Lis-Antes-INu ) ( Lis-VE-12u ) ( Lis-VER-TODOu ) 	

				(SETQ Lis-IN-12-123u nil )
				(SETQ Lis-VE-12u     nil )
				(SETQ Lis-TA-12u     nil )

				(SETQ Lis-Antes-INu  nil )
				(SETQ Lis-Antes-TAu  nil )

				(IF (= (CAL " NOR( P12u , C123ou , C123zu )") nil)
					(PROGN  (PROMPT " >>> PUNTOS (P12u C123ou C123zu) ALINEADOS PLANO-INICIO   NšSEC = ") (PRIN1 NšSEC) (TERPRI))

					(PROGN  (COMMAND "SCP" "3P" P12u  C123ou  C123zu ))						; (1) PLANO-INICIO 
				) ; if 

				;	(COMMAND "COLOR" 7  "CIRCULO" '(0 0 0)  R12 )

					(SETQ Nš1 -1)
					(REPEAT NšLados
						(SETQ Nš1 (+ Nš1 1))  ; (SETQ Nš2 (+ Nš1 1))   (IF (= Nš2  NšLados ) (SETQ Nš2 0 ))

						(SETQ V12_p (NTH Nš1  Lis-VE-12p )) (SETQ V12u (TRANS V12_p 1 0 ))  (SETQ Lis-VE-12u (CONS V12u  Lis-VE-12u ))
						(SETQ T12_p (NTH Nš1  Lis-TA-12p )) (SETQ T12u (TRANS T12_p 1 0 ))  (SETQ Lis-TA-12u (CONS T12u  Lis-TA-12u )) 

						;(COMMAND  "COLOR" (+ Nš1 1)  "PUNTO"  T12_p  )

						; (1) PUNTO INTERSECCION de LADO (V12_p T12_p) con CHARNELA (C123op C123zp)  =>  IN12_123p																

						(SETQ C123op (TRANS C123ou 0 1 ))		(SETQ C123op (CAL " XYof( C123op )"))
						(SETQ C123zp (TRANS C123zu 0 1 ))		(SETQ C123zp (CAL " XYof( C123zp )"))

						(IF (= (CAL " ILL( V12_p , T12_p , C123op , C123zp)") nil )
							(PROGN
								(PROMPT " >>>>>>>>> LINEAS PARALELAS    Nš1 = ") (PRIN1 Nš1) (TERPRI)
							) ; pro 

							(PROGN
								(SETQ IN12_123p (CAL " ILL( V12_p , T12_p , C123op , C123zp)"))

						    (SETQ IN12u (TRANS IN12_123p 1 0 ))   (SETQ Lis-IN-12-123u (CONS IN12u Lis-IN-12-123u ))

								;(COMMAND "COLOR" (+ Nš1 1)  "PUNTO" IN12_123p )
							) ; pro 
						) ; if 
					) ; repe

					(SETQ Lis-IN-12-123u (REVERSE Lis-IN-12-123u ))
					(SETQ Lis-TA-12u     (REVERSE Lis-TA-12u     ))   (SETQ Lis-TAG-TODOu (CONS Lis-TA-12u  Lis-TAG-TODOu ))
					(SETQ Lis-VE-12u     (REVERSE Lis-VE-12u     ))   (SETQ Lis-VER-TODOu (CONS Lis-VE-12u  Lis-VER-TODOu ))

					(SETQ Lis-Antes-INu  Lis-IN-12-123u )   						; Siguiente Lista Datos   
					(SETQ Lis-Antes-TAu  Lis-TA-12u     )   						; Siguiente Lista Compara 

				(COMMAND "SCP" "U")


				; (1) PINTA SECCION REF-INICIO  (COMPROBACION)																																								

				(SETQ  PINTA-SEC-REF-INICIO 'NO )								; PINTA SECC REF SCU 
				(IF (= PINTA-SEC-REF-INICIO 'SI ) (PROGN
					(SETQ Nša -1 )
					(REPEAT  (LENGTH Lis-VE-12p)
						(SETQ Nša (+ Nša 1 ))
						(SETQ Nšb (+ Nša 1 ))   (IF (= Nšb (LENGTH Lis-VE-12p)) (SETQ Nšb 0 ))

						(SETQ PV1 (NTH Nša  Lis-VE-12p))
						(SETQ PV2 (NTH Nšb  Lis-VE-12p))

						(SETQ PT1 (NTH Nša  Lis-TA-12p))
						(SETQ PT2 (NTH Nšb  Lis-TA-12p))

						(COMMAND "COLOR" (+ Nša 1 )  "LINEA" PV1 PV2 "")
						(COMMAND "COLOR" (+ Nša 1 )  "LINEA" PT1 PT2 "")
					) ; repe 
				)) ; if pro  PINTA-SEC-REF-INICIO 

			) ; pro
		) ;if (= NšSEC 0 ) 


		"################################################################################################################################"
		;---------------------------------------------------------------------------------------------------------------------------------
		; (2) PLANO-INTERMEDIO  P23-C123oz   ENTRA  SALIR 																																								
		;---------------------------------------------------------------------------------------------------------------------------------

		(IF (= (CAL " NOR( P23u , C123ou , C123zu )") nil)
			(PROGN  (PROMPT " >>> PUNTOS (P23u C123ou C123zu) ALINEADOS PLANO-INTERMEDIO  NšSEC = ") (PRIN1 NšSEC) (TERPRI))

			(PROGN  (COMMAND "SCP" "3P" P23u  C123ou  C123zu ))						; (2) PLANO-INTERMEDIO 
		) ; if 

		;	(COMMAND "COLOR" 7  "CIRCULO" '(0 0 0)  R23 )

			; (2) P-TANGENTES de IN23_123p a CIRCULO P23 R23    en TRIANGULO RECTANGULO   DATOS: ( IN23_123p  C123op  R23 )									

			(SETQ Lis-TA-23p  nil )
			(SETQ Lis-TA-23u  nil )

			(SETQ Nš3 -1)
			(REPEAT NšLados
				(SETQ Nš3 (+ Nš3 1))

				(SETQ IN23_123p (TRANS (NTH Nš3 Lis-Antes-INu ) 0 1 ))	  (SETQ IN23_123p (CAL " XYof( IN23_123p )"))

				(SETQ SENOa (/ R23 (DISTANCE '(0.0 0.0 0.0) IN23_123p )))

				(IF (> SENOa 1.0 )
					(PROGN
						(PROMPT " >>>>>>>>> PUNTO ORIGEN TANGENTES DENTRO CIRCULO   Nš3 = ") (PRIN1 Nš3) (TERPRI)

					) ; pro 
					(PROGN
						(SETQ COSEa (+ (SQRT (- 1 (* SENOa SENOa )))))
					) ; pro 
				) ; if 

				(SETQ PTgAŠ (LIST (* R23 SENOa )  (+ (* R23 COSEa ))  0.0 ))
				(SETQ PTgBŠ (LIST (* R23 SENOa )  (- (* R23 COSEa ))  0.0 ))

				; (2) ROTACION DE EJES  TRANSFORMACION de (OŠ) a (Oš)         AgB = Oš-Xš con OŠ-XŠ                   												

				(SETQ C123op (TRANS C123ou 0 1))   (SETQ C123op (CAL " XYof( C123op )"))			; corregido 

				(SETQ AgB     (CAL " ANG( [0,0,0] ,  C123op , IN23_123p )"))									; ang(P0,P1,P2) 
				(SETQ T23a_pš (CAL " ROT(  PTgAŠ  , [0,0,0] , AgB    )"))
				(SETQ T23b_pš (CAL " ROT(  PTgBŠ  , [0,0,0] , AgB    )"))											; rot(P1,P0,Ang) 

				(SETQ T1Šu (NTH Nš3 Lis-Antes-TAu ))																					; PUN TAG ANTERIOR 

				(SETQ T23a_uš (TRANS T23a_pš 1 0 ))
				(SETQ T23b_uš (TRANS T23b_pš 1 0 ))

				; (2) ELIGE PUN-TAG  => SIGNO-Z en PLANO  IN12u  P12u  P23u																																		

				(SETQ IN1Šu (NTH Nš3 Lis-Antes-INu ))

   			(COMMAND "SCP" "U")

				(IF (= (CAL " NOR( IN1Šu , P12u , P23u )") nil)
					(PROGN  (PROMPT " >>> PUNTOS (IN1Šu P12u P23u) ALINEADOS PLANO-TAG   NšSEC = ") (PRIN1 NšSEC) (TERPRI))

					(PROGN  (COMMAND "SCP" "3P" IN1Šu  P12u  P23u ))
				) ; if 

					(SETQ T1Šk    (TRANS T1Šu    0 1 ))
					(SETQ T23a_kš (TRANS T23a_uš 0 1 ))
					(SETQ T23b_kš (TRANS T23b_uš 0 1 ))

					(COND
						((AND (> (CADDR T1Šk) 0) (> (CADDR T23a_kš) 0))  (SETQ T23_p T23a_pš) (SETQ Lis-TA-23p (CONS T23_p  Lis-TA-23p)))
						((AND (< (CADDR T1Šk) 0) (< (CADDR T23a_kš) 0))  (SETQ T23_p T23a_pš) (SETQ Lis-TA-23p (CONS T23_p  Lis-TA-23p)))
						((AND (> (CADDR T1Šk) 0) (> (CADDR T23b_kš) 0))  (SETQ T23_p T23b_pš) (SETQ Lis-TA-23p (CONS T23_p  Lis-TA-23p)))
						((AND (< (CADDR T1Šk) 0) (< (CADDR T23b_kš) 0))  (SETQ T23_p T23b_pš) (SETQ Lis-TA-23p (CONS T23_p  Lis-TA-23p)))
					) ; con 
   			(COMMAND "SCP" "U")

				(COMMAND "SCP" "3P" P23u  C123ou  C123zu )

				;(COMMAND  "COLOR" (+ Nš3 1)  "PUNTO"  IN23_123p )
				;(COMMAND  "COLOR" (+ Nš3 1)  "PUNTO"  T23_p  )

				(SETQ T23_u (TRANS T23_p 1 0 ))   (SETQ Lis-TA-23u (CONS T23_u  Lis-TA-23u ))

			) ; repe  NšLados TAG2 

			(SETQ Lis-TA-23p (REVERSE Lis-TA-23p ))
			(SETQ Lis-TA-23u (REVERSE Lis-TA-23u ))  (SETQ Lis-TAG-TODOu (CONS Lis-TA-23u  Lis-TAG-TODOu ))
			(SETQ Lis-Antes-TAu  Lis-TA-23u )					; Siguiente Lista Compara 


			; (2) VERTICES VER23			INTER ( V23a_p  IN23a_p ) con ( V23b_p  IN23b_p )																											

			(SETQ Lis-VE-23p  nil )
			(SETQ Lis-VE-23u  nil )

			(SETQ NšQ -2)
			(REPEAT NšLados
				(SETQ NšQ (+ NšQ 1))
				(IF (= NšQ -1 )
					(PROGN (SETQ Nš4 (- NšLados 1 )) (SETQ Nš5     0     ))
					(PROGN (SETQ Nš4    NšQ        ) (SETQ Nš5 (+ Nš4 1 )))   
				) ; if 

				(SETQ T23a_p (NTH Nš4 Lis-TA-23p ))																		; (LENGTH Lis-TA-23p )
				(SETQ T23b_p (NTH Nš5 Lis-TA-23p ))

				(SETQ IN23a_p (TRANS (NTH Nš4 Lis-Antes-INu ) 0 1))   (SETQ IN23a_p (CAL " XYof( IN23a_p )"))
				(SETQ IN23b_p (TRANS (NTH Nš5 Lis-Antes-INu ) 0 1))   (SETQ IN23b_p (CAL " XYof( IN23b_p )"))

				(IF (= (CAL " ILL( T23a_p , IN23a_p , T23b_p , IN23b_p )") nil )
					(PROGN
						(PROMPT " >>>>>>>>> LINEAS PARALELAS    Nš4  = ") (PRIN1 Nš4) (TERPRI)
					) ; pro 

					(PROGN
						(SETQ V23p (CAL " ILL( T23a_p , IN23a_p , T23b_p , IN23b_p )"))   (SETQ Lis-VE-23p (CONS V23p  Lis-VE-23p ))
            (SETQ V23u (TRANS V23p 1 0 ))                                     (SETQ Lis-VE-23u (CONS V23u  Lis-VE-23u ))
					) ; pro 
				) ; if 

			) ; repe  NšLados VER2 

			(SETQ Lis-VE-23p (REVERSE Lis-VE-23p ))   													; (LENGTH Lis-VE-23p ) 

			; (2) INT2(2ab) = INT1(1) Siguiente Lista Datos    PUNTO INTERSECCION (VeA2p T23a_p)(C234op C234zp)															

			(SETQ Lis-IN-23-234u  nil )

			(SETQ Nš6 -1)
			(REPEAT NšLados
				(SETQ Nš6 (+ Nš6 1))   (SETQ Nš7 (+ Nš6 1))   (IF (= Nš7  NšLados ) (SETQ Nš7 0 ))

				(SETQ C234op (TRANS C234ou 0 1 ))		(SETQ C234op (CAL " XYof( C234op )"))
				(SETQ C234zp (TRANS C234zu 0 1 ))		(SETQ C234zp (CAL " XYof( C234zp )"))

				(SETQ V23a_p (NTH Nš6 Lis-VE-23p ))
				(SETQ V23b_p (NTH Nš7 Lis-VE-23p ))

				(SETQ T23a_p (NTH Nš6 Lis-TA-23p ))																		; (LENGTH Lis-TA-23p )
				(SETQ T23b_p (NTH Nš7 Lis-TA-23p ))

				(IF (= (CAL " ILL( V23a_p , T23a_p , C234op , C234zp)") nil )
					(PROGN
						(PROMPT " >>>>>>>>> LINEAS PARALELAS    Nš6  = ") (PRIN1 Nš6) (TERPRI)
					) ; pro 

					(PROGN
						(SETQ IN23_234p (CAL " ILL( V23a_p , T23a_p , C234op , C234zp)"))

						(SETQ IN23_234u (TRANS IN23_234p 1 0 ))   (SETQ Lis-IN-23-234u (CONS IN23_234u  Lis-IN-23-234u ))
					) ; pro 
				) ; if 

			) ; repe  NšLados INT2 

			(SETQ Lis-IN-23-234u (REVERSE Lis-IN-23-234u ))   ; (LENGTH Lis-IN-23-234u ) 				????????????????????????? 

			(SETQ Lis-Antes-INu  Lis-IN-23-234u )   						; Siguiente Lista Datos 

			(SETQ Lis-VE-23u (REVERSE Lis-VE-23u ))   (SETQ Lis-VER-TODOu (CONS Lis-VE-23u  Lis-VER-TODOu ))

   (COMMAND "SCP" "U") 


		"################################################################################################################################"
		;---------------------------------------------------------------------------------------------------------------------------------
		; (3) PLANO-FINAL   P34-C234oz   ENTRA      SALIR                                 																								
		;---------------------------------------------------------------------------------------------------------------------------------

		(IF (= NšSEC (- (LENGTH LIS-DATOS-SECCIONES ) 1 ))
			(PROGN

				(IF (= (CAL " NOR( P34u , C234ou , C234zu )") nil)
					(PROGN  (PROMPT " >>> PUNTOS (P34u C234ou C234zu) ALINEADOS PLANO-INICIO   NšSEC = ") (PRIN1 NšSEC) (TERPRI))

					(PROGN  (COMMAND "SCP" "3P" P34u  C234ou  C234zu ))						; (3) PLANO-FINAL 
				) ; if 

					;	(COMMAND "COLOR" 7  "CIRCULO" '(0 0 0)  R34 )

					; (3) P-TANGENTES DESDE IN34_234 a CIRCULO P34 R34    en TRIANGULO RECTANGULO   DATOS: ( IN34_234p  C234op  R34 )						

					(SETQ Lis-TA-34p  nil )
					(SETQ Lis-TA-34u  nil )

					(SETQ Nš8 -1)
					(REPEAT NšLados
						(SETQ Nš8 (+ Nš8 1))

						(SETQ IN34_234p (TRANS (NTH Nš8 Lis-IN-23-234u ) 0 1))		; *iguales* 
						(SETQ C234op (TRANS C234ou  0 1))

						(SETQ SENOa (/ R34 (DISTANCE '(0.0 0.0 0.0) IN34_234p )))

						(IF (> SENOa 1.0 )
							(PROGN
								(PROMPT " >>>>>>>>> PUNTO ORIGEN TANGENTES DENTRO CIRCULO   Nš8  = ") (PRIN1 Nš8) (TERPRI)
							) ; pro 
							(PROGN
								(SETQ COSEa (+ (SQRT (- 1 (* SENOa SENOa )))))
							) ; pro 
						) ; if 

						(SETQ PTgAŠ (LIST (* R34 SENOa )  (+ (* R34 COSEa ))  0.0 ))
						(SETQ PTgBŠ (LIST (* R34 SENOa )  (- (* R34 COSEa ))  0.0 ))

						; (3) ROTACION DE EJES  TRANSFORMACION de (OŠ) a (Oš)         AgB = Oš-Xš con OŠ-XŠ                   										

						(SETQ AgB     (CAL " ANG( [0,0,0] , C234op , IN34_234p )"))
						(SETQ T34a_pš (CAL " ROT( PTgAŠ , [0,0,0] , AgB )"))
						(SETQ T34b_pš (CAL " ROT( PTgBŠ , [0,0,0] , AgB )"))

						(SETQ T34a_uš (TRANS T34a_pš 1 0 ))
						(SETQ T34b_uš (TRANS T34b_pš 1 0 ))

						; (3) ELIGE PUN-TAG  => SIGNO-Z en PLANO  IN1Šu  P23u  P34u																																

						(SETQ T1Šu  (NTH Nš8 Lis-Antes-TAu ))																						; PUN TAG ANTERIOR 
						(SETQ IN1Šu (NTH Nš8 Lis-Antes-INu ))		; *iguales* 

   					(COMMAND "SCP" "U")

						(IF (= (CAL " NOR( IN1Šu , P23u , P34u )") nil)
							(PROGN  (PROMPT " >>> PUNTOS (IN1Šu  P23u  P34u) ALINEADOS PLANO-TAG   NšSEC = ") (PRIN1 NšSEC) (TERPRI))

							(PROGN  (COMMAND "SCP" "3P" IN1Šu  P23u  P34u ))						; (3) PLANO-TAG 
						) ; if 

							(SETQ T1Šk    (TRANS T1Šu    0 1 ))
							(SETQ T34a_kš (TRANS T34a_uš 0 1 ))
							(SETQ T34b_kš (TRANS T34b_uš 0 1 ))

							(COND
								((AND (> (CADDR T1Šk) 0) (> (CADDR T34a_kš) 0))  (SETQ T34_p T34a_pš) (SETQ Lis-TA-34p (CONS T34_p  Lis-TA-34p)))
								((AND (< (CADDR T1Šk) 0) (< (CADDR T34a_kš) 0))  (SETQ T34_p T34a_pš) (SETQ Lis-TA-34p (CONS T34_p  Lis-TA-34p)))
								((AND (> (CADDR T1Šk) 0) (> (CADDR T34b_kš) 0))  (SETQ T34_p T34b_pš) (SETQ Lis-TA-34p (CONS T34_p  Lis-TA-34p)))
								((AND (< (CADDR T1Šk) 0) (< (CADDR T34b_kš) 0))  (SETQ T34_p T34b_pš) (SETQ Lis-TA-34p (CONS T34_p  Lis-TA-34p)))
							) ; con 
   					(COMMAND "SCP" "U")

						(COMMAND "SCP" "3P" P34u  C234ou  C234zu )

						;(COMMAND  "COLOR" (+ Nš8 1)  "PUNTO"  IN34_234p ) 
						;(COMMAND  "COLOR" (+ Nš8 1)  "PUNTO"  T34_p     ) 

						(SETQ T34_u (TRANS T34_p 1 0 ))   (SETQ Lis-TA-34u (CONS T34_u  Lis-TA-34u ))

					) ; repe  NšLados TAG34 

					(SETQ Lis-TA-34p (REVERSE Lis-TA-34p ))
					(SETQ Lis-TA-34u (REVERSE Lis-TA-34u ))   (SETQ Lis-TAG-TODOu (CONS Lis-TA-34u  Lis-TAG-TODOu ))

					; (3) VERTICES VER34			INTER ( PTg3A  INT3A ) con ( PTg3B  INT3B )																												

					(SETQ Lis-VE-34u  nil )

					(SETQ NšQ -2)
					(REPEAT NšLados
						(SETQ NšQ (+ NšQ 1))
						(IF (= NšQ -1 )
							(PROGN (SETQ Nš9 (- NšLados 1 )) (SETQ Nš10     0     ))
							(PROGN (SETQ Nš9    NšQ        ) (SETQ Nš10 (+ Nš9 1 )))
						) ; if 

						(SETQ pT34a_p (NTH Nš9  Lis-TA-34p ))
						(SETQ pT34b_p (NTH Nš10 Lis-TA-34p ))

						(SETQ IN34a_p (TRANS (NTH Nš9  Lis-IN-23-234u ) 0 1))
						(SETQ IN34b_p (TRANS (NTH Nš10 Lis-IN-23-234u ) 0 1))

						(SETQ V34p (CAL " ILL( pT34a_p , IN34a_p , pT34b_p , IN34b_p )"))

						(SETQ V34u (TRANS V34p 1 0 ))  (SETQ Lis-VE-34u (CONS V34u  Lis-VE-34u ))

					) ; repe  NšLados VER2 

					(SETQ Lis-VE-34u (REVERSE Lis-VE-34u ))   (SETQ Lis-VER-TODOu (CONS Lis-VE-34u  Lis-VER-TODOu ))

   			(COMMAND "SCP" "U") 

			) ; pro
		) ;if (= FINAL) 

	) ; repe   LIS-DATOS-SECCIONES  NšSEC 

	(SETQ Lis-VER-TODOu (REVERSE Lis-VER-TODOu ))   ; (LENGTH Lis-VER-TODOu ) 
	(SETQ Lis-TAG-TODOu (REVERSE Lis-TAG-TODOu ))   ; (LENGTH Lis-TAG-TODOu ) 



	;***********************************************************************************************************************************
	;===================================================================================================================================
	;	(05) PINTA PUNTOS TAG SECIONES 																																																		

	(SETQ  PINTA-PUN-TAG 'NO )  (IF (= PINTA-PUN-TAG 'SI ) (PROGN


		(SETQ Nš11 -1)
		(REPEAT (- (LENGTH Lis-TAG-TODOu) 1 )
			(SETQ Nš11 (+ Nš11 1))

			(SETQ Nš12 -1)
			(REPEAT NšLados
				(SETQ Nš12 (+ Nš12 1))

				(SETQ TAG-A (NTH Nš12 (NTH (+ Nš11 0 )  Lis-TAG-TODOu )))
				(SETQ TAG-B (NTH Nš12 (NTH (+ Nš11 1 )  Lis-TAG-TODOu )))

				(COMMAND "COLOR" (+ Nš12 1) "LINEA" TAG-A  TAG-B "")
				(COMMAND "COLOR" (+ Nš12 1) "PUNTO" TAG-A )

				(IF (= Nš11 (- (LENGTH Lis-TAG-TODOu) 2 )) (COMMAND "COLOR" (+ Nš12 1) "PUNTO" TAG-B ))

			) ; repe  Nš12 VER 
		) ; repe   Nš11 

	)) ; pro if  PINTA-PUN-TAG 


	;***********************************************************************************************************************************
	;===================================================================================================================================
	;	(06) PINTA CIRCULOS TELA-INFLADA en SECIONES																																											

	(SETQ  PINTA-CIRCULOS-INFLADOS 'NO )  (IF (= PINTA-CIRCULOS-INFLADOS 'SI ) (PROGN


		(SETQ Nš11 -1)
		(REPEAT (LENGTH Lis-VER-TODOu )				; ((A1 A2 A3 A4..) (B1 B2 B3 B4..) ... ) = NšDiv 
			(SETQ Nš11 (+ Nš11 1))

			(SETQ DIS-Ver 0 )

			(SETQ Pc1  (NTH (+ Nš11 0)  LIS-Pun-CAMI ))
			(SETQ Pc2  (NTH (+ Nš11 1)  LIS-Pun-CAMI ))
			(SETQ Pc12 (CAL " PLT( Pc1 , Pc2 , 0.5 )"))

			(SETQ Nš12 -1)
			(REPEAT NšLados
				(SETQ Nš12 (+ Nš12 1))   (SETQ Nš13 (+ Nš12 1))   (IF (= Nš13  NšLados ) (SETQ Nš13 0 ))

				(SETQ VER-1 (NTH Nš12 (NTH Nš11  Lis-VER-TODOu )))
				(SETQ VER-2 (NTH Nš13 (NTH Nš11  Lis-VER-TODOu )))

				(SETQ DIS-Ver (+ DIS-Ver (DISTANCE VER-1 VER-2 )))

			) ; repe  Nš12 

			(SETQ RAc (/ DIS-Ver (* 2 PI)))

			(COMMAND "SCP" "EZ" Pc12 Pc2 )
				(COMMAND "COLOR" 7 "CIRCULO" '(0 0 0) RAc )						; PLANO SECCION CIRCULO TELA-INFLADA 
   		(COMMAND "SCP" "U") 

		) ; repe   Nš11 

	)) ; pro if  PINTA-CIRCULOS-INFLADOS 



	;***********************************************************************************************************************************
	;===================================================================================================================================
	;	(06) CALCULA VOLUMEN CUERPO																																																				

	(SETQ  CALCULA-VOLUMEN 'SI )  (IF (= CALCULA-VOLUMEN 'SI ) (PROGN

		(SETQ VOLUMEN-TOTAL 0 )
		(SETQ LONGITUD-EJE  0 )
		(SETQ SUMA-RADIOS   0 )
		(SETQ RADIO-MEDIO   0 )

		(SETQ NšSec -1)
		(REPEAT (- NšDiv 1)												; ((A1 A2 A3 A4..) (B1 B2 B3 B4..) ... )  = (LENGTH Lis-VER-TODOu ) 
			(SETQ NšSec (+ NšSec 1))

			(SETQ PERI-A 0 )
			(SETQ PERI-B 0 )

			(SETQ Pc1  (NTH (+ NšSec 0)  LIS-Pun-CAMI ))
			(SETQ Pc2  (NTH (+ NšSec 1)  LIS-Pun-CAMI ))
			(SETQ Pc3  (NTH (+ NšSec 2)  LIS-Pun-CAMI ))

			(SETQ Pc12 (CAL " PLT( Pc1 , Pc2 , 0.5 )"))
			(SETQ Pc23 (CAL " PLT( Pc2 , Pc3 , 0.5 )"))

			(SETQ NšL1 -1)
			(REPEAT NšLados
				(SETQ NšL1 (+ NšL1 1))
				(SETQ NšL2 (+ NšL1 1))   (IF (= NšL2  NšLados ) (SETQ NšL2 0 ))

				(SETQ VER-A1 (NTH NšL1 (NTH (+ NšSec 0)  Lis-VER-TODOu )))
				(SETQ VER-A2 (NTH NšL2 (NTH (+ NšSec 0)  Lis-VER-TODOu )))  (SETQ PERI-A (+ PERI-A (DISTANCE VER-A1 VER-A2 )))
				(SETQ VER-B1 (NTH NšL1 (NTH (+ NšSec 1)  Lis-VER-TODOu )))
				(SETQ VER-B2 (NTH NšL2 (NTH (+ NšSec 1)  Lis-VER-TODOu )))  (SETQ PERI-B (+ PERI-B (DISTANCE VER-B1 VER-B2 )))
			) ; repe  NšL1 

			(SETQ RADI-A (/ PERI-A (* 2 PI)))
			(SETQ RADI-B (/ PERI-B (* 2 PI)))

			(SETQ VOLUMEN-TOTAL (+ VOLUMEN-TOTAL (* (/ (+ (* PI RADI-A RADI-A ) (* PI RADI-B RADI-B )) 2.0 ) (DISTANCE Pc12 Pc23 ))))
			(SETQ LONGITUD-EJE  (+ LONGITUD-EJE (DISTANCE Pc12 Pc23 )))								; 567.089 
			(IF (= NšSec 0 )  (SETQ SUMA-RADIOS (+ SUMA-RADIOS  RADI-A )))
			                  (SETQ SUMA-RADIOS (+ SUMA-RADIOS  RADI-B ))
		) ; repe   NšSec 

		(SETQ RADIO-MEDIO  (/ SUMA-RADIOS  (- NšDiv 1) ))		            						; 10.4811 
		(SETQ VOLUMEN-COMPROL (* (* PI RADIO-MEDIO RADIO-MEDIO ) LONGITUD-EJE ))		;  195712.0 => 201296 


		(PROMPT " ============================================================================") (TERPRI)
		(PROMPT " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  VOLUMEN-TOTAL = ")
		                                 (PRIN1 (FIX (/ VOLUMEN-TOTAL 1000))) (PROMPT " Litros")  (TERPRI)

		(COMMAND "COLOR" 7  "TEXTO"  (LIST 0 -100)  6.0  0
						                     (STRCAT "VOLUMEN-TOTAL = " (ITOA (FIX (/ VOLUMEN-TOTAL 1000)) ) " Litros" ))


		 ; VOLUMEN-TOTAL  201296 cm3 => 210 cm ALTURA ???    201 Litros => 2,10m Altura   => 26,8 Botes Espuma de 750ml										


	)) ; pro if  CALCULA-VOLUMEN 




	
	;***********************************************************************************************************************************
	;===================================================================================================================================
	;	(07) PINTA  3DCARAS-3D  3DCARAS-2D																																																

	(SETQ  PINTA-3DC-3D-2D 'SI )  (IF (= PINTA-3DC-3D-2D 'SI ) (PROGN


		(SETQ LIS-COLUMNA-FILA-3DC-3D nil )
		(SETQ LIS-COLUMNA-FILA-3DC-2D nil )

		(SETQ NšP1 -1)
		(REPEAT NšLados
			(SETQ NšP1 (+ NšP1 1))   (SETQ NšP2 (+ NšP1 1))   (IF (= NšP2  NšLados ) (SETQ NšP2 0 ))

			(SETQ LIS-COLUMNA-3DC-3D nil )
			(SETQ LIS-COLUMNA-3DC-2D nil )

			(SETQ KK1 (LIST (* (+ NšP1 1) SEPARA-P ) 0.0  0.0 ))
			(SETQ KK2 (LIST (+ (CAR KK1) 10 )      0.0  0.0 ))

			(SETQ NšSa -1)
			(REPEAT (- (LENGTH Lis-VER-TODOu) 1 )				; ((A1 A2 A3) (B1 B2 B3) ... ) 
				(SETQ NšSa (+ NšSa 1))
				(SETQ NšSb (+ NšSa 1))

				(SETQ PA1 (NTH NšP1 (NTH NšSa  Lis-VER-TODOu )))
				(SETQ PA2 (NTH NšP2 (NTH NšSa  Lis-VER-TODOu )))

				(SETQ PB1 (NTH NšP1 (NTH NšSb  Lis-VER-TODOu )))
				(SETQ PB2 (NTH NšP2 (NTH NšSb  Lis-VER-TODOu )))

				(IF (= (REM NšP1 2 ) 0 ) (SETQ COLO 2 ) (SETQ COLO 3 ))
				"----------------------------------------------------------------------------------------------------------------------------"
				(COMMAND "COLOR" COLO   "3DCARA" PA1 PA2 PB2 PB1 "")																													; 3DCARA-3D 
				"----------------------------------------------------------------------------------------------------------------------------"

				(SETQ LIS-LADOS-3DC-3D   (LIST (LIST PA1 PA2) (LIST PA2 PB2) (LIST PB2 PB1) (LIST PB1 PA1)))									; LADOS-3DC-3D 
				(SETQ LIS-COLUMNA-3DC-3D (CONS LIS-LADOS-3DC-3D  LIS-COLUMNA-3DC-3D ))

				(COMMAND "SCP" "3P" PA1 PA2 PB1 )					; PLANO 3DC 3D 
					(SETQ PA1p (LIST 0.0 0.0 0.0))
					(SETQ PA2p (TRANS PA2 0 1 ))   (SETQ PA2p (CAL " XYof( PA2p )"))
					(SETQ PB1p (TRANS PB1 0 1 ))   (SETQ PB1p (CAL " XYof( PB1p )"))
					(SETQ PB2p (TRANS PB2 0 1 ))   (SETQ PB2p (CAL " XYof( PB2p )"))

				"----------------------------------------------------------------------------------------------------------------------------"
					(COMMAND "COLOR" 8  "TEXTO"  (LIST 0.1 0.1)  AlTex  0  (STRCAT "<" (ITOA NšP1 ) ">" (ITOA NšSa )))					; TEXTO-3D 
				"----------------------------------------------------------------------------------------------------------------------------"
   			(COMMAND "SCP" "U")

				(COMMAND "SCP" "3P" KK1 KK2 "" )					; PLANO PATRONES 2D 

				"----------------------------------------------------------------------------------------------------------------------------"
					(COMMAND "COLOR" 7   "3DCARA" PA1p PA2p PB2p PB1p "")																												; 3DCARA-2D 
				"----------------------------------------------------------------------------------------------------------------------------"

					(SETQ PA1pU (TRANS PA1p 1 0 ))   (SETQ PA1pU (CAL " XYof( PA1pU )"))
					(SETQ PA2pU (TRANS PA2p 1 0 ))   (SETQ PA2pU (CAL " XYof( PA2pU )"))
					(SETQ PB1pU (TRANS PB1p 1 0 ))   (SETQ PB1pU (CAL " XYof( PB1pU )"))
					(SETQ PB2pU (TRANS PB2p 1 0 ))   (SETQ PB2pU (CAL " XYof( PB2pU )"))

					(SETQ LIS-LADOS-3DC-2D (LIST (LIST PA1pU PA2pU) (LIST PA2pU PB2pU) (LIST PB2pU PB1pU) (LIST PB1pU PA1pU)))	; LADOS-3DC-2D U 

					(SETQ LIS-COLUMNA-3DC-2D (CONS LIS-LADOS-3DC-2D  LIS-COLUMNA-3DC-2D ))

					(SETQ KK1 (TRANS PB1p 1 0 ))
					(SETQ KK2 (TRANS PB2p 1 0 ))

				"----------------------------------------------------------------------------------------------------------------------------"
					(COMMAND "COLOR" 8  "TEXTO"  (LIST 0.1 0.1)  AlTex  0  (STRCAT "<" (ITOA NšP1 ) ">" (ITOA NšSa )))					; TEXTO-2D 
				"----------------------------------------------------------------------------------------------------------------------------"
   			(COMMAND "SCP" "U")

			) ; repe  NšP1  Vertices 

			(SETQ LIS-COLUMNA-3DC-3D      (REVERSE LIS-COLUMNA-3DC-3D ))														; (LENGTH LIS-COLUMNA-3DC-3D) 59 
			(SETQ LIS-COLUMNA-FILA-3DC-3D (CONS LIS-COLUMNA-3DC-3D  LIS-COLUMNA-FILA-3DC-3D ))
			(SETQ LIS-COLUMNA-3DC-2D      (REVERSE LIS-COLUMNA-3DC-2D ))														; (LENGTH LIS-COLUMNA-3DC-2D) 59 
			(SETQ LIS-COLUMNA-FILA-3DC-2D (CONS LIS-COLUMNA-3DC-2D  LIS-COLUMNA-FILA-3DC-2D ))

		) ; repe    NšSa  Secciones 

		(SETQ LIS-COLUMNA-FILA-3DC-3D (REVERSE LIS-COLUMNA-FILA-3DC-3D ))													; (LENGTH LIS-COLUMNA-FILA-3DC-3D) 3 
		(SETQ LIS-COLUMNA-FILA-3DC-2D (REVERSE LIS-COLUMNA-FILA-3DC-2D ))													; (LENGTH LIS-COLUMNA-FILA-3DC-2D) 3 


	)) ; pro if  PINTA-3DC-3D-2D 



	;"*********************************************************************************************************************************"
	"**********************************************************************************************************************************"
	;===================================================================================================================================
	;	(08) PINTA  LINEA GEODESICA (CREMALLERA)																																													
	;===================================================================================================================================
	"**********************************************************************************************************************************"
	;"*********************************************************************************************************************************"

	(SETQ  PINTA-LINEA-GEODESICA 'NO ) (IF (= PINTA-LINEA-GEODESICA 'SI ) (PROGN


	(SETQ PG1š nil  PG2š nil  PG3š nil  PG4š nil  PG5š nil )

	(COMMAND "-REFENT" "FIN")

	;(COMMAND "-REFENT" "CERCANO")

	  (PROMPT              " ============================================================================")  (TERPRI)
		(SETQ PG0š (GETPOINT ">>>>>>>>>>>>> MARCA 0ŠLINEAS GEODESICA >>>>>>>>>   PUNTO (BASE) <<<<<<<<<<<<<")) (TERPRI)
	  (PROMPT              " ============================================================================")  (TERPRI)
		(SETQ PG1š (GETPOINT ">>>>>>>>>>>>> MARCA 1ŠLINEAS GEODESICA >>>>>>>>> 1šPUNTO        <<<<<<<<<<<<<")) (TERPRI)
		;(SETQ PG2š (GETPOINT ">>>>>>>>>>>>> MARCA 2ŠLINEAS GEODESICA >>>>>>>>> 2šPUNTO        <<<<<<<<<<<<<")) (TERPRI)
		;(SETQ PG3š (GETPOINT ">>>>>>>>>>>>> MARCA 3ŠLINEAS GEODESICA >>>>>>>>> 3šPUNTO        <<<<<<<<<<<<<")) (TERPRI)
		;(SETQ PG4š (GETPOINT ">>>>>>>>>>>>> MARCA 4ŠLINEAS GEODESICA >>>>>>>>> 4šPUNTO        <<<<<<<<<<<<<")) (TERPRI)
		;(SETQ PG5š (GETPOINT ">>>>>>>>>>>>> MARCA 5ŠLINEAS GEODESICA >>>>>>>>> 5šPUNTO        <<<<<<<<<<<<<")) (TERPRI)

	(COMMAND "-REFENT" "DES")

	;	PINTA 5 LINEAS GEODESICAS COMPLETAS con 5 LINEAS de INICIO																																			

	(SETQ LIS-PGxš nil )
	(IF (/= PG1š nil ) (SETQ LIS-PGxš (CONS PG1š  LIS-PGxš )))
	(IF (/= PG2š nil ) (SETQ LIS-PGxš (CONS PG2š  LIS-PGxš )))
	(IF (/= PG3š nil ) (SETQ LIS-PGxš (CONS PG3š  LIS-PGxš )))
	(IF (/= PG4š nil ) (SETQ LIS-PGxš (CONS PG4š  LIS-PGxš )))
	(IF (/= PG5š nil ) (SETQ LIS-PGxš (CONS PG5š  LIS-PGxš )))
	(SETQ LIS-PGxš (REVERSE LIS-PGxš ))

	(SETQ NšPG -1)
	(REPEAT (LENGTH LIS-PGxš)
		(SETQ NšPG (+ NšPG 1))

		(SETQ PGxš (NTH NšPG  LIS-PGxš ))

		(IF (> (CADDR PG0š) (CADDR PGxš))   (PROGN (SETQ PGeo1š PGxš )   (SETQ PGeo2š PG0š ))
		    	                              (PROGN (SETQ PGeo1š PG0š )   (SETQ PGeo2š PGxš )))

	;  BUSCA en TODAS(3DC) => Nš1š2šCu (1šCuadro(3DC) de 1ŠLINEA-GEO-ACTUAL  +  2šCuadro(3DC) de LINEA-GEO-SIGUIENTE)  LADO COMUN	

	(SETQ Nš1š2šCu nil )

	(SETQ NšCOLU -1)
	(REPEAT NšLados         (SETQ NšCOLU (+ NšCOLU 1))
		(SETQ NšFILA -1)
		(REPEAT (- NšDiv 1 )  (SETQ NšFILA (+ NšFILA 1))
			(SETQ NšLADO -1)
				(REPEAT 4         (SETQ NšLADO (+ NšLADO 1))

				(SETQ Pun0 (NTH 0 (NTH NšLADO (NTH NšFILA (NTH NšCOLU  LIS-COLUMNA-FILA-3DC-3D )))))
				(SETQ Pun1 (NTH 1 (NTH NšLADO (NTH NšFILA (NTH NšCOLU  LIS-COLUMNA-FILA-3DC-3D )))))

				(IF (EQUAL (CAL " VEC1( Pun0 , Pun1 )") (CAL " VEC1( Pun0 , PGeo2š  )") 0.001 ) ; mUNI

					  (PROGN   (SETQ Nš1š2šCu (CONS (LIST NšCOLU  NšFILA  NšLADO ) Nš1š2šCu ))))

			) ; repe  NšLADO 
		) ; repe  NšFILA 
	) ; repe  NšCOLU 

	(SETQ Nš1š2šCu (REVERSE Nš1š2šCu ))		;	((NšCo1  NšFi1  NšLa1) (NšCo2  NšFi2  NšLa2))  LADO COMUN en 1š y 2š CUADROS CONSECUTIVOS 



	;  LA LISTA => ( LIS-COLUMNA-FILA-3DC-3D ) ESTA ORDENADA por COLUMNAS ((Co/0 Fi/0...Co/0 Fi/n)...(Co/n Fi/0...Co/n Fi/n)) 					

	;  CUADRO de la 1ŠLinea GEODESICA de los 2 de lista => ( Nš1š2šCu ) 																																

	(SETQ NšQ (NTH 0 Nš1š2šCu ))
	(SETQ NšK (NTH 1 Nš1š2šCu ))

	(SETQ LADOS-NšQd3 (NTH (NTH 1 NšQ) (NTH (NTH 0 NšQ) LIS-COLUMNA-FILA-3DC-3D )))
	(SETQ LADOS-NšKd3 (NTH (NTH 1 NšK) (NTH (NTH 0 NšK) LIS-COLUMNA-FILA-3DC-3D )))

	(SETQ Q1 (NTH 0 (NTH 0  LADOS-NšQd3)))    (SETQ K1 (NTH 0 (NTH 0  LADOS-NšKd3)))
	(SETQ Q2 (NTH 1 (NTH 0  LADOS-NšQd3)))    (SETQ K2 (NTH 1 (NTH 0  LADOS-NšKd3)))

	(COND
		((< (ABS (CAL " DIST(Q1 , Q2) - (DIST(Q1 , PGeo1š) + DIST(PGeo1š , Q2)) ")) mUNI )
		                                                      (SETQ NšA1 (NTH 0 Nš1š2šCu ))
		                                                      (SETQ NšA2 (NTH 1 Nš1š2šCu )))

		((< (ABS (CAL " DIST(K1 , K2) - (DIST(K1 , PGeo1š) + DIST(PGeo1š , K2)) ")) mUNI )
		                                                      (SETQ NšA1 (NTH 1 Nš1š2šCu ))
		                                                      (SETQ NšA2 (NTH 0 Nš1š2šCu )))

		(  T  (PROMPT " ------------------- NO CUMPLE CONDICION Q-K 1ŠGEO ? ------------")  (TERPRI))
	) ; con


	; 1Š LINEA GEODESICA en 3D y 2D PATRONES  INICIO																																										

	"--------------------------------------------------------------------------------------------------------------------------------"
	(COMMAND "COLOR" (- 7 (+ NšPG 1))  "LINEA" PGeo1š  PGeo2š "")	 																	; 1šLINEA GEODESICA 3D INICIO 
	"--------------------------------------------------------------------------------------------------------------------------------"

	(SETQ LADOS-NšA1d3 (NTH (NTH 1 NšA1) (NTH (NTH 0 NšA1) LIS-COLUMNA-FILA-3DC-3D )))
	(SETQ LADOS-NšA1d2 (NTH (NTH 1 NšA1) (NTH (NTH 0 NšA1) LIS-COLUMNA-FILA-3DC-2D )))

	(SETQ oA1d3 (NTH 0  (NTH 0  LADOS-NšA1d3)))
	(SETQ oA2d3 (NTH 1  (NTH 0  LADOS-NšA1d3)))
	(SETQ oB1d3 (NTH 1  (NTH 2  LADOS-NšA1d3)))

	(COMMAND "SCP" "3P" oA1d3  oA2d3  oB1d3 )         																							; Plano CARA-3D 
		(SETQ  PGeoA2D (TRANS PGeo1š 0 1))     (SETQ PGeoA2D (CAL " XYof( PGeoA2D )"))
		(SETQ  PGeoB2D (TRANS PGeo2š 0 1))     (SETQ PGeoB2D (CAL " XYof( PGeoB2D )"))
	(COMMAND "SCP" "U") 

	(SETQ oA1d2 (NTH 0  (NTH 0  LADOS-NšA1d2)))
	(SETQ oA2d2 (NTH 1  (NTH 0  LADOS-NšA1d2)))
	(SETQ oB1d2 (NTH 1  (NTH 2  LADOS-NšA1d2)))

	(COMMAND "SCP" "3P" oA1d2  oA2d2  oB1d2 )	         																					 		 ; Plano CARA-2D 
	"--------------------------------------------------------------------------------------------------------------------------------"
			(COMMAND "COLOR" (- 7 (+ NšPG 1))  "LINEA" PGeoA2D  PGeoB2D "")															; 1Š LINEA GEODESICA 2D INICIO 
	"--------------------------------------------------------------------------------------------------------------------------------"
	(COMMAND "SCP" "U") 


	;  PUNTOS  CUADRO-GEO-ACTUAL(NšA1) y CUADRO-GEO-SIGUIENTE(NšA2)      CUADROS CONSECUTIVOS con LADO COMUN														

	;(REPEAT (* 2 NšDiv )       ; SE DETIENE PROGRAMA con ERROR     LIS-COLUMNA-FILA-3DC-3D => nil       ?????????????????

	(SETQ WW T )
	(SETQ NšdeR -1 )

	(WHILE WW

		(SETQ NšdeR (+ NšdeR 1 ))

		;                          FILA              COLUMNA                            
		(SETQ LADOS-NšA1 (NTH (NTH 1 NšA1) (NTH (NTH 0 NšA1) LIS-COLUMNA-FILA-3DC-3D )))
		(SETQ LADOS-NšA2 (NTH (NTH 1 NšA2) (NTH (NTH 0 NšA2) LIS-COLUMNA-FILA-3DC-3D )))

		(COND ;  Lado COMUN Cua-A1   Lado COMUN Cua-A2                                              ; oA1 o------------o oA2 
			((AND (= (NTH 2 NšA1) 0 ) (= (NTH 2 NšA2) 2 ))  ; con1        PUNTO   LADO                ;     |  1  L2  0  |     
				                                              (SETQ oA1 (NTH 1  (NTH 2  LADOS-NšA1)))		;     |0          1|     
				                                              (SETQ oA2 (NTH 0  (NTH 2  LADOS-NšA1)))		;     |L3 (CuA1) L1|     
				                                              (SETQ oB1 (NTH 0  (NTH 0  LADOS-NšA1)))		;     |1          0|     
				                                              (SETQ oB2 (NTH 1  (NTH 0  LADOS-NšA1)))		;     |  0  L0  1  |     
				                                              (SETQ oC1 (NTH 0  (NTH 0  LADOS-NšA2)))		; oB1 o------------o oB2 
				                                              (SETQ oC2 (NTH 1  (NTH 0  LADOS-NšA2)))   ;     |  1  L2  0  |     
                                                      (SETQ NšL-B1C1 3 )                        ;     |0          1|     
                                                      (SETQ NšL-C1C2 0 )                        ;     |L3 (CuA2) L1|     
                                                      (SETQ NšL-C2B2 1 ))                       ;     |1          0|     
                                                                                                ;     |  0  L0  1  |     
                                                                                                ; oC1 o------------o oC2 

			((AND (= (NTH 2 NšA1) 1 ) (= (NTH 2 NšA2) 3 ))  ; con2        PUNTO   LADO                ; oA2          oB2          oC2 
				                                              (SETQ oA1 (NTH 0  (NTH 0  LADOS-NšA1)))   ;  o------------o------------o  
				                                              (SETQ oA2 (NTH 1  (NTH 2  LADOS-NšA1)))		;  |  1  L2  0  |  1  L2  0  |  
				                                              (SETQ oB1 (NTH 1  (NTH 0  LADOS-NšA1)))		;  |0          1|0          1|  
				                                              (SETQ oB2 (NTH 0  (NTH 2  LADOS-NšA1)))		;  |L3 (CuA1) L1|L3 (CuA2) L1|  
				                                              (SETQ oC1 (NTH 1  (NTH 0  LADOS-NšA2)))		;  |1          0|1          0|  
				                                              (SETQ oC2 (NTH 0  (NTH 2  LADOS-NšA2))) 	;  |  0  L0  1  |  0  L0  1  |  
                                                      (SETQ NšL-B1C1 0 )                        ;  o------------o------------o  
                                                      (SETQ NšL-C1C2 1 )                        ; oA1          oB1          oC1 
                                                      (SETQ NšL-C2B2 2 ))

			((AND (= (NTH 2 NšA1) 2 ) (= (NTH 2 NšA2) 0 ))  ; con3        PUNTO   LADO                ; oC1 o------------o oC2 
				                                              (SETQ oA1 (NTH 0  (NTH 0  LADOS-NšA1)))   ;     |  1  L2  0  |     
				                                              (SETQ oA2 (NTH 1  (NTH 0  LADOS-NšA1)))	  ;     |0          1|     
				                                              (SETQ oB1 (NTH 1  (NTH 2  LADOS-NšA1)))		;     |L3 (CuA2) L1|     
				                                              (SETQ oB2 (NTH 0  (NTH 2  LADOS-NšA1)))		;     |1          0|     
				                                              (SETQ oC1 (NTH 1  (NTH 2  LADOS-NšA2)))		;     |  0  L0  1  |     
				                                              (SETQ oC2 (NTH 0  (NTH 2  LADOS-NšA2)))   ; oB1 o------------o oB2 
                                                      (SETQ NšL-B1C1 3 )                        ;     |  1  L2  0  |     
                                                      (SETQ NšL-C1C2 2 )                        ;     |0          1|     
                                                      (SETQ NšL-C2B2 1 ))                       ;     |L3 (CuA1) L1|     
                                                                                                ;     |1          0|     
                                                                                                ;     |  0  L0  1  |     
                                                                                                ; oA1 o------------o oA2 

			((AND (= (NTH 2 NšA1) 3 ) (= (NTH 2 NšA2) 1 ))  ; con4        PUNTO   LADO                ; oC2          oB2          oA2 
				                                              (SETQ oA1 (NTH 0  (NTH 1  LADOS-NšA1)))		;  o------------o------------o  
				                                              (SETQ oA2 (NTH 1  (NTH 1  LADOS-NšA1)))		;  |  1  L2  0  |  1  L2  0  |  
				                                              (SETQ oB1 (NTH 1  (NTH 3  LADOS-NšA1)))		;  |0          1|0          1|  
				                                              (SETQ oB2 (NTH 0  (NTH 3  LADOS-NšA1)))		;  |L3 (CuA2) L1|L3 (CuA1) L1|  
				                                              (SETQ oC1 (NTH 1  (NTH 3  LADOS-NšA2)))		;  |1          0|1          0|  
				                                              (SETQ oC2 (NTH 0  (NTH 3  LADOS-NšA2)))   ;  |  0  L0  1  |  0  L0  1  |  
                                                      (SETQ NšL-B1C1 0 )                        ;  o------------o------------o  
                                                      (SETQ NšL-C1C2 3 )                        ; oC1          oB1          oA1 
                                                      (SETQ NšL-C2B2 2 ))

			(  T  (PROMPT " ------------------- NO CUMPLE CONDICION LADOS ? ------------------")  (TERPRI))
		) ; con


		;                                                                                                       
		;                                            o InC2B2                                                   
		;                                           /|                                                          
		;                                          / |                                                          
		;                                         /  |                                                          
		;                                        /   |                                                          
		;                                       /    |                                                          
		;                       InC1C2 = PGeoC /     |                                                          
		;           oC1 O---------------------o------o oC2                                                      
		;               |                    /       |                                                          
		;               |                   /        |                                                          
		;               |            PGeoR o         |                                                          
		;               |  (oB2 +ROT(AgG))/          |                                                          
		;               |                /           |                                                          
		;               |               /   ROT(AgG) |                                                          
		;               |              /             |                                                          
		;           oB1 o-------------o--------------o oB2                                                      
		;               |            / PGeo2š         |                                                         
		;               |      AgG  /                |                                                          
		;               |          /                 |                                                          
		;               |         /                  |                                                          
		;               |        /                   |                                                          
		;               |       /                    |                                                          
		;               |      /                     |                                                          
		;           oA1 o-----o----------------------o oA2                                                      
		;               |    / PGeo1š                                                                           
		;               |   /                                                                                   
		;               |  /                                                                                    
		;               | /                                                                                     
		;               |/                                                                                      
		;               o InB1C1                                                                                
		;                                                                                                       
		
		;  SIGUIENTE LINEA-GEODESICA-3D  ( PGeo1š PGeo2š ) => ( PGeo2š PGeoC )																														

		(SETQ Vn0    (CAL " NOR( oA1  , oA2 , oB1 )"))																		; VECTOR UNI-NORMAL CUADRO-0   
		(SETQ AgG    (CAL " ANG( PGeo2š , oB1 , PGeo1š , PGeo2š + Vn0 )"))								; Ag = ANG( Po , P1 , P2 , Pz )

		;	(SETQ Vn1    (CAL " NOR( oB1 , oB2  , oC1 )"))																		; VECTOR UNI-NORMAL CUADRO-1   
		;	(SETQ PGeoR  (CAL " ROT( oB2 , PGeo2š , PGeo2š + Vn1 , AgG )"))										; P2 = ROT( P1 , Po , Pz , Ag )

		;	(SETQ InB1C1 (CAL " ILL( PGeo2š , PGeoR , oB1 , oC1 )"))													; 1ŠGEO NO PLANO => nil ???  
		;	(SETQ InC1C2 (CAL " ILL( PGeo2š , PGeoR , oC1 , oC2 )"))
		;	(SETQ InC2B2 (CAL " ILL( PGeo2š , PGeoR , oC2 , oB2 )"))

		;	(COND
		;		((< (ABS (CAL " DIST(oB1 , oC1) - (DIST(oB1 , InB1C1) + DIST(InB1C1 , oC1)) ")) mUNI ) (SETQ PGeoC InB1C1   NšLadoIN  NšL-B1C1))
		;		((< (ABS (CAL " DIST(oC1 , oC2) - (DIST(oC1 , InC1C2) + DIST(InC1C2 , oC2)) ")) mUNI ) (SETQ PGeoC InC1C2   NšLadoIN  NšL-C1C2))
		;		((< (ABS (CAL " DIST(oC2 , oB2) - (DIST(oC2 , InC2B2) + DIST(InC2B2 , oB2)) ")) mUNI ) (SETQ PGeoC InC2B2   NšLadoIN  NšL-C2B2))
		;		(  T  (PROMPT " ------------------- NO CUMPLE CONDICION DIST ? ------------------")  (TERPRI))
		;	) ; con


		;	Sobre PLANO  ROTACION e INTERSECCION en 2D																																											

		(COMMAND "SCP" "3P" oB1  oB2  oC1 )

			(SETQ oB1p '(0.0 0.0 0.0))
			(SETQ oB2p (TRANS oB2 0 1))     (SETQ oB2p (CAL "  Xof( oB2p )"))
			(SETQ oC1p (TRANS oC1 0 1))     (SETQ oC1p (CAL " XYof( oC1p )"))
			(SETQ oC2p (TRANS oC2 0 1))     (SETQ oC2p (CAL " XYof( oC2p )"))

			(SETQ PGeo2šp (TRANS PGeo2š 0 1))  (SETQ PGeo2šp (CAL " XYof( PGeo2šp )"))
			(SETQ PGeoRp  (CAL " ROT( oB2p , PGeo2šp , AgG )"))																	; P2 = ROT( P1 , Po , Ag )

			(SETQ InB1C1p (CAL " ILL( PGeo2šp , PGeoRp , oB1p , oC1p )"))
			(SETQ InC1C2p (CAL " ILL( PGeo2šp , PGeoRp , oC1p , oC2p )"))
			(SETQ InC2B2p (CAL " ILL( PGeo2šp , PGeoRp , oC2p , oB2p )"))


			(COND
				((< (ABS (CAL " DIST(oB1p , oC1p) - (DIST(oB1p , InB1C1p) + DIST(InB1C1p , oC1p)) ")) mUNI )
									            (SETQ PGeoC  (TRANS InB1C1p 1 0)       NšLadoIN  NšL-B1C1))
				((< (ABS (CAL " DIST(oC1p , oC2p) - (DIST(oC1p , InC1C2p) + DIST(InC1C2p , oC2p)) ")) mUNI )
			                        (SETQ PGeoC  (TRANS InC1C2p 1 0)       NšLadoIN  NšL-C1C2))
				((< (ABS (CAL " DIST(oC2p , oB2p) - (DIST(oC2p , InC2B2p) + DIST(InC2B2p , oB2p)) ")) mUNI )
									            (SETQ PGeoC  (TRANS InC2B2p 1 0)       NšLadoIN  NšL-C2B2))

				(  T  (PROMPT " ------------------- NO CUMPLE CONDICION DIST ? ------------------")  (TERPRI))
			) ; con

		(COMMAND "SCP" "U")

		; LINEA GEODESICA en 3D y 2D PATRONES																																															

		"--------------------------------------------------------------------------------------------------------------------------------"
		(COMMAND "COLOR" (- 7 (+ NšPG 1))  "LINEA" PGeo2š  PGeoC "")	 																; RESTO LINEA GEODESICA 3D 
		"--------------------------------------------------------------------------------------------------------------------------------"
																																													 
		(SETQ LADOS-NšA2d3 (NTH (NTH 1 NšA2) (NTH (NTH 0 NšA2) LIS-COLUMNA-FILA-3DC-3D )))
		(SETQ LADOS-NšA2d2 (NTH (NTH 1 NšA2) (NTH (NTH 0 NšA2) LIS-COLUMNA-FILA-3DC-2D )))

		(SETQ oA1d3 (NTH 0 (NTH 0 LADOS-NšA2d3)))
		(SETQ oA2d3 (NTH 1 (NTH 0 LADOS-NšA2d3)))
		(SETQ oB1d3 (NTH 1 (NTH 2 LADOS-NšA2d3)))


		(COMMAND "SCP" "3P" oA1d3  oA2d3  oB1d3 )         																						; Plano CARA-3D 
			(SETQ  PGeoB2D (TRANS PGeo2š 0 1))     (SETQ PGeoB2D (CAL " XYof( PGeoB2D )"))
			(SETQ  PGeoC2D (TRANS PGeoC  0 1))     (SETQ PGeoC2D (CAL " XYof( PGeoC2D )"))
		(COMMAND "SCP" "U") 

		(SETQ oA1d2 (NTH 0 (NTH 0 LADOS-NšA2d2)))
		(SETQ oA2d2 (NTH 1 (NTH 0 LADOS-NšA2d2)))
		(SETQ oB1d2 (NTH 1 (NTH 2 LADOS-NšA2d2)))

		(COMMAND "SCP" "3P" oA1d2  oA2d2  oB1d2 )	         																					  ; Plano CARA-2D 
		"--------------------------------------------------------------------------------------------------------------------------------"
			(COMMAND "COLOR" (- 7 (+ NšPG 1))  "LINEA" PGeoB2D  PGeoC2D "")															; RESTO LINEA GEODESICA 2D 
		"--------------------------------------------------------------------------------------------------------------------------------"
		(COMMAND "SCP" "U") 


		;  CUADRO/B1-2Š-GEO-(NšB1) y CUADRO/B2-SIGUIENTE-2Š-GEO-(NšB2)																																		

		(SETQ NšB1 (LIST (NTH 0 NšA2) (NTH 1 NšA2) NšLadoIN ))

		(COND 
			((= (NTH 2 NšB1) 0 )  (SETQ NšB2  (LIST    (NTH 0 NšA2)      (- (NTH 1 NšA2) 1 )  2 )) )
			((= (NTH 2 NšB1) 1 )  (SETQ NšB2  (LIST (+ (NTH 0 NšA2) 1 )     (NTH 1 NšA2)      3 )) )
			((= (NTH 2 NšB1) 2 )  (SETQ NšB2  (LIST    (NTH 0 NšA2)      (+ (NTH 1 NšA2) 1 )  0 )) )
			((= (NTH 2 NšB1) 3 )  (SETQ NšB2  (LIST (- (NTH 0 NšA2) 1 )     (NTH 1 NšA2)      1 )) )

			(  T  (PROMPT " ------------------- NO CUMPLE CONDICION NšB2 ? ------------------")  (TERPRI))
		) ; con

		(IF (= (NTH 0 NšB2) NšLados )  (SETQ NšB2 (LIST       0        (NTH 1 NšB2) (NTH 2 NšB2))))		; SIGUIENTE a ULTIMA COLUMNA 
		(IF (= (NTH 0 NšB2)   -1    )  (SETQ NšB2 (LIST (- NšLados 1 ) (NTH 1 NšB2) (NTH 2 NšB2))))		; ALTERIOR a PRIMERA COLUMNA 

		(IF (> (NTH 1 NšB2) (- NšDiv 2 )) (SETQ WW nil ))																							; SIGUIENTE a ULTIMA FILA 
		(IF (< (NTH 1 NšB2)      0      ) (SETQ WW nil ))																							; ALTERIOR a PRIMERA FILA 
		(IF (>    NšdeR     (* 3 NšDiv )) (SETQ WW nil ))																							; SALIDA de SEGURIDAD  WW 


		; CAMBIA VALORES para SIGUENTE Repeat																																															

		(SETQ PGeo1š  PGeo2š )
		(SETQ PGeo2š  PGeoC  )

		(SETQ NšA1  NšB1 )
		(SETQ NšA2  NšB2 )

	) ;  While WW 

	) ; repe NšPG 

	))   ; pro if  PINTA-LINEA-GEODESICA 


	;===================================================================================================================================
	;	() PARANDO																																																												
	(SETVAR "blipmode" 1)  (SETVAR "cmdecho"  1)

	(PROMPT " ============================================================================") (TERPRI)
	(PROMPT " >>>> FINAL >>>>>>>>>>>>>>>>>>> ESCULTURA-NUDO-03 >>>>>>>>>>>>>>>>>>>>>>>>>>>") (TERPRI)
	(PROMPT " ============================================================================") (TERPRI)

) ; cierre DEFUN    ESCULTURA-NUDO-03 

"####################################################################################################################################"
;-------------------------------------------------------------------------------------------------------------------------------------







