tyrese69_ Posté(e) le 4 avril 2012 Posté(e) le 4 avril 2012 Bonjour à tous, Est ce que quelqu'un connait la routine "GetVectors.lsp" et la boite de dialogue associée "GetVectors.dcl" ? Ces deux fichiers sont en lisp US est il possible de vérifier et/ou terminer la transposition internationale ! Et il y a t'il quelqu'un qui l'a déjà utilisé ? Daniel OLIVES site en référence:GetVectors.lspGetVectors.dcl
tyrese69_ Posté(e) le 4 avril 2012 Auteur Posté(e) le 4 avril 2012 http://web2.airmail.net/terrycad/LISP/ le site en lien !
bonuscad Posté(e) le 4 avril 2012 Posté(e) le 4 avril 2012 Bonjour, Sans méchanceté, si tu n'arrives pas à le traduire, je doute que tu arrives à l'utiliser...Ce programme est destiné à des programmeurs voulant inclure une image (fabriqué depuis des entités d'Autocad) dans une boite de dialogue.Je te l'ai quand même traduit (testé rapidement pour voir si je n'avais rien oublié lors de la traduction, mais pas testé l'intégration dans une conception de boite de dialogue)GetVectors.lspGetVectors.dcl Choisissez un travail que vous aimez et vous n'aurez pas à travailler un seul jour de votre vie. - Confucius
tyrese69_ Posté(e) le 5 avril 2012 Auteur Posté(e) le 5 avril 2012 Bonjour, Sans méchanceté, si tu n'arrives pas à le traduire, je doute que tu arrives à l'utiliser...Ce programme est destiné à des programmeurs voulant inclure une image (fabriqué depuis des entités d'Autocad) dans une boite de dialogue.Je te l'ai quand même traduit (testé rapidement pour voir si je n'avais rien oublié lors de la traduction, mais pas testé l'intégration dans une conception de boite de dialogue) Bonjour,Ce n'est que par manque d'habitude avec les commandes et variable US que je bloque sur la traduction !Mais je te remercie grandement pour ton aide !Je fais des tests et vous tiendrais au courant de la suite ! Daniel OLIVES
tyrese69_ Posté(e) le 5 avril 2012 Auteur Posté(e) le 5 avril 2012 Bonsoir,La vectorisation avec "Getvectors.lsp" est bien moins bonne qu'avec ce lisp (joint!) ! Qui fourni réalise un fichier du type "LogoTPS.lsp" Ce qui permet d'avoir un fichier vectorisé qui peut être mis dans une boite de dialogue comme logo ! Je suis en train d'essayer de mieux comprendre son usage pour terminer cette DCL avec logo ! Daniel OLIVESVECTORIZE.lsplogoTPS.lsp
tyrese69_ Posté(e) le 12 avril 2012 Auteur Posté(e) le 12 avril 2012 Bonjour à tous,Afin de clore ce sujet après la vectorisation du logo via "Vectorize.lsp", voici son utilisation dans une DCL dans un lisp qui affiche une page d'aide si nécessaire ! Cette boite est un extrait de MyDialogs.lsp et dcl dans l'exemple donné sur le forum Theswamp. Daniel OLIVESFichier trop gros pour être mis en pièce jointe ! ;; V0.00.01 - 11/04/2012 ;; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ; Technip TPS - dolives - 10/02/2007 ; = = = = = = = = = = = = = = = = = = = = = = = = = = == = = = = = = = = = ; -- TPS_DCL.LSP -- Fonctions particulières ; Copyright: ; ©Technip TPS - Etablissement de Lyon ; Notes: ; None ;;;------------------------------------ ;; Commentaires de révisions: ;;------------------------------------ ; Révision : mise à jour le ;; - - - - - - - - - - - - - - - - - - - - - - - - ;; SOMMAIRE ;; - - - - - - - - - - - - - - - - - - - - - - - - ; - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - ; 01 - Routine principale ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * (defun c:DCL ( / fn dcl_file fn dcl_id) (setq fn (open (setq dcl_file (vl-filename-mktemp "tempdcl.tmp")) "w")) ; open temporary dialogue (foreach item (list ; save each line to dialogue file "DEMO : dialog {" " label = \"Un petit exemple de logo 'Vectorisé' \";" " initial_focus = \"ok_button\";" " : spacer { " " width = 80;" " height = 20;" " }" " : row {" " fixed_width = true;" " alignment = centered;" " is_bold = true;" " : ok_button {" " width = 11;" " height = 2.5;" " }" " : spacer { " " width = 5;" " }" " : button {" " key = \"Info\";" " label = \"Info\";" " width = 11;" " height = 2.5;" " fixed_width = true;" " }" " }" " : row {" " : image {" " key = \"LOGO\";" ; image key referenced by lisp call " alignment = left;" ; width,24.92, height,6.12 " color = -15;" ; set image background colour to match dialog colour " width = 24.92;" ; image width in dcl units to match vector units " height = 6.12;" ; image height in dcl units " fixed_width = true;" ; prevent image from stretching with dialog box " fixed_height = true;" ; prevent image from stretching with dialog box " }" " : paragraph {" " : text_part {" " is_bold = true;" " label = \"Designed and Created\";" " } " " : text_part {" " label = \"by Daniel OLIVES - Technip TPS - Lyon\";" " }" " }" " }" "}" ) (princ item fn) ) (close fn) ; close dialogue file (setq dcl_id (load_dialog dcl_file)) ; load dialogue file (if (not (if dcl_XY (new_dialog "DEMO" dcl_id "" dcl_XY)(new_dialog "DEMO" dcl_id))) ; (if (not (if dcl_XY (new_dialog "DclCalcs_Info" dcl_id "" dcl_XY)(new_dialog "DclCalcs_Info" dcl_id))) (progn (prompt "\nDynamic Dialogue Extraction Failed.") (exit) ) ) (logoTPS "LOGO") ; fill image using vectors within 'DEMO-VECTORS' function (action_tile "accept" "(setq dcl_XY (done_dialog))") ; save dialogue position and exit. (action_tile "Info" "(c:dcli)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete dcl_file) ; erase temporary dialogue file (princ) ) (defun c:DCLI ( / fn dcl_file% fn dcl_id%) (defun *error* ( msg ) (if dch (unload_dialog dch)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (setq fn% (open (setq dcl_file% (vl-filename-mktemp "tempdcl%.tmp")) "w")) ; open temporary dialogue (setq Info$ (strcat " ----------------Texte de la boite de dialogue autoadaptative -------------------" "----------------- \n\n" " In the Images and Tiles section, the values of the X Pixels and Y Pixels " "correspond to the return of the dimx_tile and dimy_tile variables in image " "tiles. The algorithm to determine the values in this section may also be used " "to calculate the width and height of other type of tiles as well. The change " "in other tiles may not relate to Pixels, but as incremental changes instead.\n\n" " In the Text and Tile Widths section, the widths are calculated based upon " "the longest phrase needed. This section is very useful for aligning a column " "of text with popup_list and edit_box tiles. This method ignores the hard coded " "dcl labels for popup_list and edit_box tiles, and provides a dynamic alternative " "of being able to change the text labels within AutoLISP.\n\n" " The toggles for Popup List and Edit Box determine the combination of choices " "that will be used in a column. If only one toggle is selected, it calculates " "the needed width per the longest phrase needed. If both toggles are selected, " "it recalculates the widths to align both types in a column. Also notice that " "the Text Column width for the Edit Box is equivalent to one pixel greater than " "the Text Column width for the Popup List.\n\n" " In the List Box Tiles section, enter the desired number of lines to display " "in a list_box tile and the corresponding height is displayed. If the number " "of lines is one of the ones that are skipped in dcl, it will display a message " "with all of the skipped lines within a reasonable range.\n\n" " The Calculator image button runs the Windows calculator, which is handy for " "doing some calculations while still in the dialog.")) ; (setq Larg_DCL 100.0) ; (if (not Phrases@) (setq Phrases@ (PhraseList Info$ Larg_DCL));*Included );if ; ; Autoadapte la hauteur au nombre de lignes + 1 (setq Haut_DCL (+ 1 (length Phrases@))) ; ; Autoadapte les dimensions selon largeur sélectionnée ! (foreach item (list ; save each line to dialogue file "DclCalcs_Info : dialog {" " key = \"Title\";" " label = \"\";" " : list_box {" " key = \"List1\";" (strcat " height = " (rtos (+ 1 Haut_DCL)) ";") " fixed_height = true;" (strcat " width = " (rtos (+ 1 Larg_DCL)) ";") " fixed_width = true;" " }" " ok_only;" "}" ) (princ item fn%) ) (close fn%) ; close dialogue file (setq dcl_id% (load_dialog dcl_file%)) ; load dialogue file ; Restitue position sauvegardée de la fenêtre (setq dcl_XY (cond ( *screenpoint* ) ( '(-1 -1) ))) (if (not (if dcl_XY (new_dialog "DclCalcs_Info" dcl_id% "" dcl_XY)(new_dialog "DclCalcs_Info" dcl_id%))) (progn (prompt "\nL'Extraction Dynamique de la Fenêtre de Dialogue est Erronée.") (exit) ) ) (set_tile "Title" " Information complémentaires - Technip TPS") (set_tile_list "List1" Phrases@ "");*Included (action_tile "accept" "(setq *screenpoint* (done_dialog 1))") ; sauvegarde position fenêtre (start_dialog) (setq Dcl_Id% (unload_dialog Dcl_Id%)) ; (unload_dialog Dcl_Id%) (vl-file-delete dcl_file%) ; erase temporary dialogue file (princ) ) ;------------------------------------------------------------------------------- ; set_tile_list - Sets a dialog popup_list or list_box tile to a list ; Arguments: 3 ; KeyName$ = Key name of tile ; ListName@ = The list to set in tile ; Selected = An item in the ListNames@ or a list of items selected ; Syntax: (set_tile_list "TileName" '("A" "B" "C") "B") ; (set_tile_list "TileName" '("A" "B" "C") '("A" "C")) ; Returns: Sets Selected items in dialog popup_list or list_box tiles. ;------------------------------------------------------------------------------- (defun set_tile_list (KeyName$ ListName@ Selected / Item) (start_list KeyName$ 3) (mapcar 'add_list ListName@) (end_list) (foreach Item (if (listp Selected) Selected (list Selected)) (if (member Item ListName@) (set_tile KeyName$ (itoa (- (length ListName@) (length (member Item ListName@))))) );if );foreach );defun set_tile_list ;------------------------------------------------------------------------------- ; DclTextWidth - List of the width in pixels and the dcl width of a string ; Arguments: 1 ; Str$ = String ; Returns: List of the width in pixels and the dcl width of a string. ;------------------------------------------------------------------------------- (defun DclTextWidth (Str$ / Cnt# Mid$ Pixels# PixelWidth~) (setq Cnt# 1 Pixels# 0 PixelWidth~ 0) (if (= (type Str$) 'STR) (repeat (strlen Str$) (setq Mid$ (substr Str$ Cnt# 1)) (cond ((member Mid$ (list "@" "W")) (setq Pixels# (+ Pixels# 11));11 Pixels );case ((= Mid$ "M") (setq Pixels# (+ Pixels# 9));9 Pixels );case ((member Mid$ (list "%" "D" "G" "H" "N" "O" "Q" "R" "U" "m" "w")) (setq Pixels# (+ Pixels# 8));8 Pixels );case ((member Mid$ (list "#" "A" "B" "C" "E" "K" "P" "S" "T" "V" "X" "Y" "Z" "~")) (setq Pixels# (+ Pixels# 7));7 Pixels );case ((member Mid$ (list "$" "&" "+" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "<" "=" ">" "?" "F" "L" "^" "_" "a" "b" "c" "d" "e" "g" "h" "k" "n" "o" "p" "q" "u" "v")) (setq Pixels# (+ Pixels# 6));6 Pixels );case ((member Mid$ (list (chr 34) "/" "J" (chr 92) "s" "x" "y" "z")) (setq Pixels# (+ Pixels# 5));5 Pixels );case ((member Mid$ (list "*" "{" "}")) (setq Pixels# (+ Pixels# 4));4 Pixels );case ((member Mid$ (list " " "!" "(" ")" "," "-" "." ":" ";" "I" "[" "]" "`" "f" "r" "t")) (setq Pixels# (+ Pixels# 3));3 Pixels );case ((member Mid$ (list "'" "i" "j" "l" "|")) (setq Pixels# (+ Pixels# 2));2 Pixels );case ((member (ascii Mid$) (list 198 230)) (setq Pixels# (+ Pixels# 10));10 Pixels );case ((= (ascii Mid$) 169) (setq Pixels# (+ Pixels# 9));9 Pixels );case ((member (ascii Mid$) (list 174 188 189 190 208 209 210 211 212 213 214 216 217 218 219 220)) (setq Pixels# (+ Pixels# 8));8 Pixels );case ((member (ascii Mid$) (list 192 193 194 195 196 197 199 200 201 202 203 221 222)) (setq Pixels# (+ Pixels# 7));7 Pixels );case ((member (ascii Mid$) (list 128 162 163 164 165 167 171 172 175 177 181 182 187 191 215 223 224 225 226 227 228 229 231 232 233 234 235 240 241 242 243 244 245 246 247 248 249 250 251 252 254 255)) (setq Pixels# (+ Pixels# 6));6 Pixels );case ((= (ascii Mid$) 253) (setq Pixels# (+ Pixels# 5));5 Pixels );case ((member (ascii Mid$) (list 170 176 186 237 238 239)) (setq Pixels# (+ Pixels# 4));4 Pixels );case ((member (ascii Mid$) (list 127 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 168 173 178 179 180 183 184 185 204 205 206 207)) (setq Pixels# (+ Pixels# 3));3 Pixels );case ((member (ascii Mid$) (list 166 236)) (setq Pixels# (+ Pixels# 2));2 Pixels );case (t (setq Pixels# (+ Pixels# 7));7 Pixels default );case );cond (setq Cnt# (1+ Cnt#)) );repeat );if (if (> Pixels# 0) (setq PixelWidth~ (atof (rtos (+ (* (1- Pixels#) (/ 1 6.0)) 0.09) 2 2))) );if (list Pixels# PixelWidth~) );defun DclTextWidth ;------------------------------------------------------------------------------- ; PhraseList - Returns a list of phrases of a String within a certain DclWidth~ ; Arguments: 2 ; Str$ = String to divide into phrases ; DclWidth~ = Dcl width needed to fit the phrase ; Returns: List of phrases within the DclWidth~ range of the String ; (setq Phrases@ (PhraseList Info$ 100)) ;------------------------------------------------------------------------------- (defun PhraseList (Str$ DclWidth~ / Cnt# Current$ ListBox@ Mid$ Temp$) (setq Current$ "" Temp$ "" Cnt# 1 Str$ (strcat Str$ "\n")) (repeat (strlen Str$) (setq Mid$ (substr Str$ Cnt# 1)) (cond ((= Mid$ " ") (if (<= (nth 1 (DclTextWidth (strcat Current$ Temp$))) DclWidth~) (setq Current$ (strcat Current$ Temp$) Temp$ " ") (setq ListBox@ (append ListBox@ (list Current$)) Current$ (substr Temp$ 2) Temp$ " " );setq );if );case ((= Mid$ "\n") (if (<= (nth 1 (DclTextWidth (strcat Current$ Temp$))) DclWidth~) (setq Current$ (strcat Current$ Temp$ " ") Temp$ "") );if (setq ListBox@ (append ListBox@ (list Current$)) Current$ (substr Temp$ 2) Temp$ "" );setq (if (/= Current$ "") (setq ListBox@ (append ListBox@ (list Current$)) Current$ "" Temp$ "" );setq );if );case (t (setq Temp$ (strcat Temp$ Mid$))) );cond (setq Cnt# (1+ Cnt#)) );repeat (if (/= Current$ "") (setq ListBox@ (append ListBox@ (list Current$))) );if ListBox@ );defun PhraseList ;******************************************************************************** ; Function to draw a vector image within a dialogue Image tile or Image Button. * ; Argument: 'DCLKEY' - the dcl key of the image tile/button to be filled. * ; Do NOT edit the dcl dimension text below, this is needed by Vectorize. * ;******************************************************************************** ; Compiled for dcl dimensions of width,24.92, height,6.12, * ;******************************************************************************** (defun LOGOTPS (DCLKEY / i j) (setq i (/ (dimx_tile DCLKEY) 151.) j (/ (dimy_tile DCLKEY) 81.)) ;(setq i (/ (dimx_tile DCLKEY) 302.) j (/ (dimy_tile DCLKEY) 162.)) (start_image DCLKEY) (fill_image 0 0 (dimx_tile DCLKEY)(dimy_tile DCLKEY) -15) (foreach x '((134 55 144 55 1) (126 55 144 55 1) (120 56 145 56 1) (114 56 145 56 1) (111 56 145 56 1) (107 56 145 56 1) (104 56 145 56 1) (101 56 145 56 1) (99 56 145 56 1) (96 56 145 56 1) (93 56 144 56 1) (91 56 144 56 1) (88 56 144 56 1) (86 57 144 57 1) (84 57 144 57 1) (82 57 144 57 1) (80 57 144 57 1) (78 57 143 57 1) (77 57 143 57 1) (75 57 143 57 1) (73 57 143 57 1) (72 57 143 57 1) (70 57 143 57 1) (68 58 142 58 1) (66 58 142 58 1) (65 58 142 58 1) (63 58 142 58 1) (62 58 142 58 1) (60 58 141 58 1) (59 58 141 58 1) (57 58 141 58 1) (56 58 141 58 1) (54 58 141 58 1) ... ( attention logo réduit ) .... (vector_image (fix (* (car x) i))(fix (* (cadr x) j))(fix (* (caddr x) i))(fix (* (cadddr x) j))(last x))) (end_image) (princ) )
Messages recommandés
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 compteSe connecter
Vous avez déjà un compte ? Connectez-vous ici.
Connectez-vous maintenant