Aller au contenu

Réduction Acier en 2 d


usegomme

Messages recommandés

Bonsoir Guigues et les autres.

Voilà les réductions en acier avant ton départ , comme ça tu auras de quoi mettre dans ta valise. (pour ceux qui ne suivent pas aller voir "réduction inox 2d")

En espérant n'avoir pas laisser de bug.

a+

 

; Réduction ACIER en 2D version 1
; usegomme le 18/06/2009

(defun c:RedAcier2d (/ pd pdir pf pm a h dn d1 d2 e pm rm part1 sv_dm dm)
 (command "_undo" "_be")
 (command "_undo" "_be")
 (setq abase (getvar "angbase")
       adir  (getvar "angdir")
       aun   (getvar "aunits")
       echo  (getvar "cmdecho")
 )
 (setvar "cmdecho" 0)(setvar "angbase" 0)(setvar "angdir" 0)(setvar "aunits" 0)
 (command "_ucs" "_s" "tempftd")
 (if (not (zerop (getvar "cmdactive")))
   (command "_y")
 )
 (setq pd (getpoint "\nPoint de départ de la reduction  :"))
 (if pd (setq pdir (getpoint pd "\n direction de la réduction <0>: ")))
 (cond
   ((and pd pdir)
     (setvar "ELEVATION" 0)
     (command "_ucs" "_zaxis" "_none" Pd "_none" pdir)
     (command "_ucs" "_x" "270")
     (command "_ucs" "_z" "270")
     (setq pd '(0. 0. 0.))
   )
 )
 (cond
   (pd
     (setq sv_dm (getvar "DYNMODE"))
     (cond ((< sv_dm 0) (setq dm (* sv_dm -1)) (setvar "DYNMODE" dm))
          (t (setq sv_dm nil dm nil )
          )
     )
     (setq d1 nil  d2 nil )
     (while (not d1)
       (initget "20 25 32 40 50 65 80 100 125 150")
       (setq dn (getkword "\n DN [20/25/32/40/50/65/80/100/125/150]:"))
       (cond
          ((= dn "20") (setq d1 26.9))
          ((= dn "25") (setq d1 33.7))
          ((= dn "32") (setq d1 42.4))
          ((= dn "40") (setq d1 48.3))
          ((= dn "50") (setq d1 60.3))
          ((= dn "65") (setq d1 76.1))
          ((= dn "80") (setq d1 88.9))
          ((= dn "100") (setq d1 114.3))
          ((= dn "125") (setq d1 139.7))
          ((= dn "150") (setq d1 168.3))
          ((= dn "200") (setq d1 219.1))
          ((= dn "250") (setq d1 273))
          ((= dn "300") (setq d1 323.9))
          (t (princ))
       )
     )
     
     (while (not d2)
       (cond 
         ((= dn "20")
           (initget "25 32 40")
           (setq dn (getkword "\n DN [25/32/40]:"))
           (cond
             ((= dn "25")(setq d2 33.7 h 35 e 2.3))((= dn "32")(setq d2 42.4 h 51 e 2.3))((= dn "40")(setq d2 48.3 h 67 e 2.6))
           )
         )
         ((= dn "25")
           (initget "20 32 40 50")
           (setq dn (getkword "\n DN [20/32/40/50]:"))
           (cond
             ((= dn "20")(setq d2 26.9 h 35 e 2.6))((= dn "32")(setq d2 42.4 h 39 e 2.6))((= dn "40")(setq d2 48.3 h 55 e 2.6))
             ((= dn "50")(setq d2 60.3 h 77 e 2.9))
           )
         )
         ((= dn "32")
           (initget "20 25 40 50 65")
           (setq dn (getkword "\n DN [20/25/40/50/65]:"))
           (cond
             ((= dn "20")(setq d2 26.9 h 51 e 2.6))((= dn "25")(setq d2 33.7 h 39 e 2.6))((= dn "40")(setq d2 48.3 h 38 e 2.6))
             ((= dn "50")(setq d2 60.3 h 61 e 2.9))((= dn "65")(setq d2 76.1 h 95 e 2.9))
           )
         )
         ((= dn "40")
           (initget "20 25 32 50 65 80")
           (setq dn (getkword "\n DN [20/25/32/50/65/80]:"))
           (cond
             ((= dn "20")(setq d2 26.9 h 67 e 2.6))((= dn "25")(setq d2 33.7 h 55 e 2.6))((= dn "32")(setq d2 42.4 h 38 e 2.6))
             ((= dn "50")(setq d2 60.3 h 50 e 2.9))((= dn "65")(setq d2 76.1 h 84 e 2.9))((= dn "80")(setq d2 88.9 h 108 e 3.2))
           )
         )
         ((= dn "50")
           (initget "25 32 40 65 80 100")
           (setq dn (getkword "\n DN [25/32/40/65/80/100]:"))
           (cond
             ((= dn "25")(setq d2 33.7 h 77 e 2.9))((= dn "32")(setq d2 42.4 h 61 e 2.9))((= dn "40")(setq d2 48.3 h 50 e 2.9))
             ((= dn "65")(setq d2 76.1 h 63 e 2.9))((= dn "80")(setq d2 88.9 h 86 e 3.2))((= dn "100")(setq d2 114.3 h 143 e 3.6))
           )
         )
         ((= dn "65")
           (initget "32 40 50 80 100")
           (setq dn (getkword "\n DN [32/40/50/80/100]:"))
           (cond
             ((= dn "32")(setq d2 42.4 h 95 e 2.9))((= dn "40")(setq d2 48.3 h 84 e 2.9))((= dn "50")(setq d2 60.3 h 63 e 2.9))
             ((= dn "80")(setq d2 88.9 h 65 e 3.2))((= dn "100")(setq d2 114.3 h 114 e 3.6))
           )
         )
         ((= dn "80")
           (initget "40 50 65 100 125 150")
           (setq dn (getkword "\n DN [40/50/65/100/125/150]:"))
           (cond
             ((= dn "40")(setq d2 48.3 h 108 e 3.2))((= dn "50")(setq d2 60.3 h 86 e 3.2))((= dn "65")(setq d2 76.1 h 65 e 3.2))
             ((= dn "100")(setq d2 114.3 h 90 e 3.6))((= dn "125")(setq d2 139.7 h 135 e 4))((= dn "150")(setq d2 168.3 h 189 e 4.5))
           )
         )
         ((= dn "100")
           (initget "50 65 80 125 150")
           (setq dn (getkword "\n DN [50/65/80/125/150]:"))
           (cond
             ((= dn "50")(setq d2 60.3 h 143 e 3.6))((= dn "65")(setq d2 76.1 h 114 e 3.6))((= dn "80")(setq d2 88.9 h 90 e 3.6))
             ((= dn "125")(setq d2 139.7 h 88 e 4))((= dn "150")(setq d2 168.3 h 141 e 4.5))
           )
         )
         ((= dn "125")
           (initget "80 100 150")
           (setq dn (getkword "\n DN [80/100/150]:"))
           (cond
             ((= dn "80")(setq d2 88.9 h 135 e 4))((= dn "100")(setq d2 114.3 h 88 e 4))((= dn "150")(setq d2 168.3 h 94 e 4.5))
           )
         )
         ((= dn "150")
           (initget "80 100 125")
           (setq dn (getkword "\n DN [80/100/125]:"))
           (cond
             ((= dn "80")(setq d2 88.9 h 189 e 4.5))((= dn "100")(setq d2 114.3 h 141 e 4.5))((= dn "125")(setq d2 139.7 h 94 e 4.5))
           )
         )
       )
     )
     (if sv_dm
       (setvar "DYNMODE" sv_dm)
     )
   )
 )
 
 (cond
   (d2
     (setq hc (/ (* (sin (* pi (/ 75 180.0))) (abs (/ (- d1 d2) 2)))
          (cos (* pi (/ 75 180.0)))
             )
     )
     (setq hd (- h hc))
     (setq pf (list (+ (car pd) h) (cadr pd)))
     (initget "Aucun")
     (setq a (getangle pd  "\nSi excentrique TANGENT de quel coté?[]:" ))
     (if (= a "Aucun")(setq a nil)(prompt "\n "))
     (cond
       (a(if (and (> a 0) (< a pi))(setq a (* 0.5 pi))(setq a (* 1.5 pi)))
         (setq pf (polar pf a (- (/ d1 2) (/ d2 2))))
       )
     )
     (while (not d2)
       (cond 
         ((= dn "20")
           (initget "25 32 40")
           (setq dn (getkword "\n DN [25/32/40]:"))
           (cond
             ((= dn "25")(setq d2 33.7 h 35 e 2.3))((= dn "32")(setq d2 42.4 h 51 e 2.3))((= dn "40")(setq d2 48.3 h 67 e 2.6))
           )
         )
         ((= dn "25")
           (initget "20 32 40 50")
           (setq dn (getkword "\n DN [20/32/40/50]:"))
           (cond
             ((= dn "20")(setq d2 26.9 h 35 e 2.6))((= dn "32")(setq d2 42.4 h 39 e 2.6))((= dn "40")(setq d2 48.3 h 55 e 2.6))
             ((= dn "50")(setq d2 60.3 h 77 e 2.9))
           )
         )
         ((= dn "32")
           (initget "20 25 40 50 65")
           (setq dn (getkword "\n DN [20/25/40/50/65]:"))
           (cond
             ((= dn "20")(setq d2 26.9 h 51 e 2.6))((= dn "25")(setq d2 33.7 h 39 e 2.6))((= dn "40")(setq d2 48.3 h 38 e 2.6))
             ((= dn "50")(setq d2 60.3 h 61 e 2.9))((= dn "65")(setq d2 76.1 h 95 e 2.9))
           )
         )
         ((= dn "40")
           (initget "20 25 32 50 65 80")
           (setq dn (getkword "\n DN [20/25/32/50/65/80]:"))
           (cond
             ((= dn "20")(setq d2 26.9 h 67 e 2.6))((= dn "25")(setq d2 33.7 h 55 e 2.6))((= dn "32")(setq d2 42.4 h 38 e 2.6))
             ((= dn "50")(setq d2 60.3 h 50 e 2.9))((= dn "65")(setq d2 76.1 h 84 e 2.9))((= dn "80")(setq d2 88.9 h 108 e 3.2))
           )
         )
         ((= dn "50")
           (initget "25 32 40 65 80 100")
           (setq dn (getkword "\n DN [25/32/40/65/80/100]:"))
           (cond
             ((= dn "25")(setq d2 33.7 h 77 e 2.9))((= dn "32")(setq d2 42.4 h 61 e 2.9))((= dn "40")(setq d2 48.3 h 50 e 2.9))
             ((= dn "65")(setq d2 76.1 h 63 e 2.9))((= dn "80")(setq d2 88.9 h 86 e 3.2))((= dn "100")(setq d2 114.3 h 143 e 3.6))
           )
         )
         ((= dn "65")
           (initget "32 40 50 80 100")
           (setq dn (getkword "\n DN [32/40/50/80/100]:"))
           (cond
             ((= dn "32")(setq d2 42.4 h 95 e 2.9))((= dn "40")(setq d2 48.3 h 84 e 2.9))((= dn "50")(setq d2 60.3 h 63 e 2.9))
             ((= dn "80")(setq d2 88.9 h 65 e 3.2))((= dn "100")(setq d2 114.3 h 114 e 3.6))
           )
         )
         ((= dn "80")
           (initget "40 50 65 100 125 150")
           (setq dn (getkword "\n DN [40/50/65/100/125/150]:"))
           (cond
             ((= dn "40")(setq d2 48.3 h 108 e 3.2))((= dn "50")(setq d2 60.3 h 86 e 3.2))((= dn "65")(setq d2 76.1 h 65 e 3.2))
             ((= dn "100")(setq d2 114.3 h 90 e 3.6))((= dn "125")(setq d2 139.7 h 135 e 4))((= dn "150")(setq d2 168.3 h 189 e 4.5))
           )
         )
         ((= dn "100")
           (initget "50 65 80 125 150")
           (setq dn (getkword "\n DN [50/65/80/125/150]:"))
           (cond
             ((= dn "50")(setq d2 60.3 h 143 e 3.6))((= dn "65")(setq d2 76.1 h 114 e 3.6))((= dn "80")(setq d2 88.9 h 90 e 3.6))
             ((= dn "125")(setq d2 139.7 h 88 e 4))((= dn "150")(setq d2 168.3 h 141 e 4.5))
           )
         )
         ((= dn "125")
           (initget "80 100 150")
           (setq dn (getkword "\n DN [80/100/150]:"))
           (cond
             ((= dn "80")(setq d2 88.9 h 135 e 4))((= dn "100")(setq d2 114.3 h 88 e 4))((= dn "150")(setq d2 168.3 h 94 e 4.5))
           )
         )
         ((= dn "150")
           (initget "80 100 125")
           (setq dn (getkword "\n DN [80/100/125]:"))
           (cond
             ((= dn "80")(setq d2 88.9 h 189 e 4.5))((= dn "100")(setq d2 114.3 h 141 e 4.5))((= dn "125")(setq d2 139.7 h 94 e 4.5))
           )
         )
       )
     )
     
     (if (> d1 d2)
       (setq pm (list (+ (car pd) hd) (cadr pd)))
       (setq pm (list (+ (car pd) hc) (cadr pf)))
     )
     (setq pw (getvar "plinewid"))
     (setvar "plinewid" 0)
     (command "_pline"
             "_non" (polar pd (* 0.5 pi) (/ d1 2))
             "_non" (polar pd (* 1.5 pi) (/ d1 2))
             "_non" (polar pm (* 1.5 pi) (if (> d1 d2)(/ d1 2)(/ d2 2)))
             "_non" (polar pf (* 1.5 pi) (/ d2 2))
             "_non" (polar pf (* 0.5 pi) (/ d2 2))
             "_non" (polar pm (* 0.5 pi) (if (> d1 d2)(/ d1 2)(/ d2 2)))
             "_c"
     )
     (setvar "plinewid" pw)
   )
 )
 (setvar "angbase" abase)
 (setvar "angdir" adir)
 (setvar "aunits" aun)
 (if pdir (command "_ucs" "_r" "tempftd"))
 (command "_undo" "_e")
 (princ "Longueur ")
 (princ h)
 (prin1)
)


Lien vers le commentaire
Partager sur d’autres sites

je test ton lisp au bureau lundi !!

 

moi qui voulais en faire un ... merci de m'épargner cette épreuve :D

 

un grand merci pour ce petit lisp

Raph.

Celui qui pose une question est bête 5 minutes, celui qui n'en pose pas l'est toute sa vie !

Lien vers le commentaire
Partager sur d’autres sites

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer. Politique de confidentialité