viernes, 19 de abril de 2013
Rutina STAR (dibuja una estrella)
; Star -- Draw a Star
(defun C:STAR ()
(initget 1) ;prevent null input
(setq Center (getpoint "Center of Star: ")) ;get center of star
(initget (+ 1 2 4)) ;prevent null, zero, negative input
(setq OutRad (getdist "Outside Radius: " Center)) ;get outside radius
(initget (+ 1 2 4)) ;prevent null, zero, negative input
(setq InRad (getdist "Inside Radius: " Center)) ;get insider radius
(initget (+ 1 2 4)) ;prevent null, zero, negative input
(setq Points (getint "Number of Points: ")) ;:get number of points
(while (< Points 2) ;if not enough points (while Points < 2) ....
(prompt "Must have at least 2 points!\n")
(initget (+ 1 2 4)) ;prevent null, zero, negative input
(setq Points (getint "Number of Points: ")) ;get number of points
)
(setq Incr (/ (* 2 pi) Points)) ;angular increment
(setq Incr2 (/ Incr 2)) ;half of increment
(command "PLINE") ;start polyline
(setq Count 0) ;set counter
(while (< Count Points) ;loop for points (until Count = Points)....
(command (polar Center (* Count Incr) OutRad)) ;pick outside point
(if (= Count 0) ;if first segmnt
(command "width" "0" "0")) ;set line width to zero
(command (polar Center (+ (* Count Incr) Incr2) InRad)) ;pick inside
(setq Count (1+ Count)) ;increment counter
)
(command "Close") ;close polyline
(princ) ;prevent echo
)
; Load Message
(princ "\nStar by Carl Guerin !!/11/92")
(princ "\nDraw a star (center, outside, inside, points). Type STAR to use")
(princ)
Rutina ESCA - para hacer escaleras
(defun C:ESCA ()
(setq pbx (getvar "pickbox"))
(setq osnp (getvar "osmode"))
(command "_setvar" "PICKBOX" 0)
(command "_setvar" "OSMODE" 0)
(setq P1 (getpoint "\nPunto de arranque:"))
(setq DSY (getdist "\nAltura a salvar:"))
(setq DSX (getdist "\nLongitud a salvar:"))
(setq CAN (getint "\nN§ de escalones:"))
(setq SEN (getint "\nIzq[2] Dcha[1]:"))
(setq DS1 (- (/ DSY CAN) 0.03))
(setq DS2 0.05)
(setq DS3 0.03)
(setq DS4 (+ (/ DSX CAN) 0.05))
(while (> CAN 0)
(setq P2 (polar P1 (/ PI 2) DS1))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(if (= SEN 1)
(setq P2 (polar P1 PI DS2))
)
(if (= SEN 2)
(setq P2 (polar P1 0 DS2))
)
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (/ PI 2) DS3))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(if (= SEN 1)
(setq P2 (polar P1 0 DS4))
)
(if (= SEN 2)
(setq P2 (polar P1 PI DS4))
)
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq CAN (- CAN 1))
)
(command "_setvar" "PICKBOX" PBX)
(command "_setvar" "OSMODE" OSNP)
(princ)
)
Rutina VENT
(defun C:VENT ()
(setq pbx (getvar "pickbox"))
(setq osnp (getvar "osmode"))
(command "_setvar" "PICKBOX" 0)
(command "_setvar" "OSMODE" 0)
(setq P1 (getpoint "\nPunto de insercion:"))
(setq M (getdist "\nModulo de la ventna:"))
(setq AL (getdist "\nAltura del modulo:"))
(setq CAN (getint "\nN§ de modulos:"))
(setq CX (getint "\nCristales en:"))
(setq CY (getint "\nCristales en:"))
(setq DS1 0.05)
(setq DS2 0.03)
(setq DS3 0.02)
(setq DS4 (/ (-(- M (* DS1 2)) (* (+ CX 1) DS2)) CX))
(setq DS5 (/ (-(- AL (* DS1 2)) (* (+ CY 1) DS2)) CY))
(setq DS6 (- DS4 (* DS3 2)))
(setq DS7 (- DS5 (* DS3 2)))
(setq DS8 (- M (* DS1 2)))
(setq DS9 (- AL (* DS1 2)))
(while (> CAN 0)
(command "_COLOR" 5 "")
(setq P2 (polar P1 (/ PI 2) AL))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 0 M))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) AL))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 PI M))
(command "_LINE" P1 P2 "" )
(setq AUX1 P1)
(setq P1 (polar P1 (/ PI 2) DS1))
(setq P1 (polar P1 PI (- M DS1)))
(setq P2 (polar P2 (/ PI 2) (- AL DS1)))
(setq P2 (polar P2 0 DS1))
(command "_COLOR" "_bylayer" "")
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 0 DS8))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) DS9))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 PI DS8))
(command "_LINE" P1 P2 "")
(setq CSY CY)
(while (> CSY 0)
(setq P1 (polar P1 (/ PI 2) DS2))
(setq CSX CX)
(while (> CSX 0)
(setq P1 (polar P1 PI DS2))
(setq P2 (polar P1 PI DS4))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (/ PI 2) DS5))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 0 DS4))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) DS5))
(command "_LINE" P1 P2 "")
(setq P1 (polar P2 PI DS4))
(setq CSX (- CSX 1))
(setq AUX2 P1)
(setq P1 (polar P1 0 DS3))
(setq P1 (polar P1 (/ PI 2) DS3))
(setq P2 (polar P1 0 DS6))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (/ PI 2) DS7))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 PI DS6))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) DS7))
(command "_LINE" P1 P2 "")
(setq P1 AUX2)
)
(setq P1 (polar P1 0 (- DS8 DS2)))
(setq P1 (polar P1 (/ PI 2) DS5))
(setq CSY (- CSY 1))
)
(setq P1 (polar P1 0 DS1))
(setq P1 (polar P1 (* PI 1.5) DS1))
(setq P1 AUX1)
(setq CAN (- CAN 1))
)
(command "_setvar" "PICKBOX" PBX)
(command "_setvar" "OSMODE" OSNP)
(princ)
)
(setq pbx (getvar "pickbox"))
(setq osnp (getvar "osmode"))
(command "_setvar" "PICKBOX" 0)
(command "_setvar" "OSMODE" 0)
(setq P1 (getpoint "\nPunto de insercion:"))
(setq M (getdist "\nModulo de la ventna:"))
(setq AL (getdist "\nAltura del modulo:"))
(setq CAN (getint "\nN§ de modulos:"))
(setq CX (getint "\nCristales en
(setq CY (getint "\nCristales en
(setq DS1 0.05)
(setq DS2 0.03)
(setq DS3 0.02)
(setq DS4 (/ (-(- M (* DS1 2)) (* (+ CX 1) DS2)) CX))
(setq DS5 (/ (-(- AL (* DS1 2)) (* (+ CY 1) DS2)) CY))
(setq DS6 (- DS4 (* DS3 2)))
(setq DS7 (- DS5 (* DS3 2)))
(setq DS8 (- M (* DS1 2)))
(setq DS9 (- AL (* DS1 2)))
(while (> CAN 0)
(command "_COLOR" 5 "")
(setq P2 (polar P1 (/ PI 2) AL))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 0 M))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) AL))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 PI M))
(command "_LINE" P1 P2 "" )
(setq AUX1 P1)
(setq P1 (polar P1 (/ PI 2) DS1))
(setq P1 (polar P1 PI (- M DS1)))
(setq P2 (polar P2 (/ PI 2) (- AL DS1)))
(setq P2 (polar P2 0 DS1))
(command "_COLOR" "_bylayer" "")
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 0 DS8))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) DS9))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 PI DS8))
(command "_LINE" P1 P2 "")
(setq CSY CY)
(while (> CSY 0)
(setq P1 (polar P1 (/ PI 2) DS2))
(setq CSX CX)
(while (> CSX 0)
(setq P1 (polar P1 PI DS2))
(setq P2 (polar P1 PI DS4))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (/ PI 2) DS5))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 0 DS4))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) DS5))
(command "_LINE" P1 P2 "")
(setq P1 (polar P2 PI DS4))
(setq CSX (- CSX 1))
(setq AUX2 P1)
(setq P1 (polar P1 0 DS3))
(setq P1 (polar P1 (/ PI 2) DS3))
(setq P2 (polar P1 0 DS6))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (/ PI 2) DS7))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 PI DS6))
(command "_LINE" P1 P2 "")
(setq P1 P2)
(setq P2 (polar P1 (* PI 1.5) DS7))
(command "_LINE" P1 P2 "")
(setq P1 AUX2)
)
(setq P1 (polar P1 0 (- DS8 DS2)))
(setq P1 (polar P1 (/ PI 2) DS5))
(setq CSY (- CSY 1))
)
(setq P1 (polar P1 0 DS1))
(setq P1 (polar P1 (* PI 1.5) DS1))
(setq P1 AUX1)
(setq CAN (- CAN 1))
)
(command "_setvar" "PICKBOX" PBX)
(command "_setvar" "OSMODE" OSNP)
(princ)
)
jueves, 20 de mayo de 2010
Proyecto en 3D
Suscribirse a:
Entradas (Atom)