viernes, 19 de abril de 2013

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)
)

No hay comentarios:

Publicar un comentario