;; =================================================================================================== ;; carrerond.lsp ;; os 17.05.2007 ;; Réalisation par Olivier D. - Solaronics Bekaert ;; Création d'une transformation Carré Rond ;; =================================================================================================== (in-package :GD-package) (use-package :OLI) (sd-defdialog 'macro_olivier_1 :dialog-title "Menu Olivier" ;:toolbox-button nil :variables '( ("PiÉce") (TEIL :value-type :part-incl-new :title "Nom" :initial-value "/aaa" :prompt-text "SpÅcifiez le nom de la piÉce.") (AKT_WP :value-type :wp :title "Plan" :prompt-text "SpÅcifiez le plan de travail." :initial-value (sd-inq-curr-wp) ) ("Infos Carre Rond") (Largeur :value-type :length :title "Horizontal" :initial-value 250 :prompt-text "SpÅcifiez la distance verticale du carrÅ.") (Longueur :value-type :length :title "Vertical" :initial-value 150 :prompt-text "SpÅcifiez la distance horizontale du carrÅ.") (Diametre :value-type :length :title "DiamÉtre" :initial-value 90 :prompt-text "SpÅcifiez le diamÉtre extÅrieur.") (Hauteur :value-type :length :title "Hauteur" :initial-value 200 :prompt-text "SpÅcifiez la hauteur du CarrÅ Rond.") (DeportH :value-type :length :title "DÅport H." :prompt-text "SpÅcifiez le dÅport horizontal." :initial-VALUE 0) (DeportV :value-type :length :title "DÅport V" :prompt-text "SpÅcifiez le dÅport vertical." :initial-VALUE 0) ("Position") (Centre :value-type :point-3d :title "Centre" :prompt-text "Centre du carré Rond.") ("-") (Suivant :push-action (sd-call-cmds (macro_olivier_2)) :after-input (progn (setf Point nil) (setf diam_int nil) )) );;variables ;; ------------------------------------------------------------------------------------------ :local-functions `( (macro_olivier_2 () (let ((C1 (make-gpnt2d :x DeportH :y DeportV )) ;; centre du cercle (A (make-gpnt2d :x (/ (- Largeur) 2) :y (/ Longueur 2) )) ;; point haut gauche (B (make-gpnt2d :x (/ Largeur 2) :y (/ Longueur 2) )) ;; point haut droit (C (make-gpnt2d :x (/ Largeur 2) :y (/ (- Longueur) 2) )) ;; point bas droit (D (make-gpnt2d :x (/ (- Largeur) 2) :y (/ (- Longueur) 2) )) ;; point bas gauche (E (make-gpnt2d :x (/ (- Largeur 6) 2) :y (/ Longueur 2) )) ;; point haut gauche - rayon (Ray_ext) (R1) (v1) (v2) (list-vertex (list)) ) (sd-call-cmds (create_wpset :name "swp1" :owner "/")) (setq Ray_ext (/ Diametre 2)) ;; Rayon (setq R1 (sqrt (- (* Ray_ext Ray_ext) 1))) ;; projection rayon sur verticale (setf C3 (make-gpnt2d :x (- 1) :y (+ R1))) (setf C4 (make-gpnt2d :x (+ 1) :y (+ R1))) (setf C5 (make-gpnt2d :x (- 1) :y (- R1))) (setf C6 (make-gpnt2d :x (+ 1) :y (- R1))) (setf C7 (make-gpnt2d :x (+ R1) :y (- 1 ))) (setf C8 (make-gpnt2d :x (+ R1) :y (+ 1 ))) (setf C9 (make-gpnt2d :x (- R1) :y (- 1 ))) (setf C10 (make-gpnt2d :x (- R1) :y (+ 1 ))) ;;--------------------- Création du plan de travail pour le Carré ---------------------------- (create_workplane :copy :source AKT_WP :name "AE_tmp" :owner "/swp1" :translate :two_ptv (sd-inq-wp-origin AKT_WP) Centre) (sd-call-cmds (delete_2d :current_wp :edge_2d :all_2d) :failure nil) (geometry_mode :real) (sd-call-cmds (rectangle D B)) ;; Creation du carre) (sd-call-cmds (fillet :create :fillet_radius 3 A B C D)) ;; Creation des conges (setf v1 (sd-call-cmds (get_selection :select :selected_wp "/swp1/AE_tmp" :vertex_2d E))) (push v1 list-vertex) (sd-call-cmds (create_workplane :new :name "AE_tmp1" :owner "/swp1" :par_wp :offset Hauteur )) ;; Création du plan de travail pour le rond (sd-call-cmds (circle :radius Ray_ext C1)) ;; Création du rond ;;---------------------- Segmenter le cercle en plusieurs points ------------------------------ (split C3 C3) (split C4 C4) (split C5 C5) (split C6 C6) (split C7 C7) (split C8 C8) (split C9 C9) (split C10 C10) ;;--------------------- creation du volume ------------------------------------------------ (setf v2 (sd-call-cmds (get_selection :select :selected_wp "/swp1/AE_tmp1" :vertex_2d C3))) (push v2 list-vertex) (apply #'CREATE_MATCH_LINE list-vertex) (sd-call-cmds (add_loft :part (format nil "/~a" TEIL) :tool "/swp1" :keep_tool :no)) ;;propriete de l acier (set_part_inst_density :parts TEIL :dens 0.00785) (set_part_inst_color :parts TEIL :color (sd-rgb-to-color 0.6,0.6,0.6)) ;;Acitvation de l ancien plan de travail (current_wp AKT_WP) );;let );;macro_olivier_2 );;local-functions ;;:ok-action '(macro_olivier_2) );;sd-defdialog ;; ===================================================================================================