Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/10/2022 in all areas

  1. ;;; declare ALL GLOBAL variables ;;; If you don't they can bite you (take it from an old dragon like despicable me) (defun c:INSERTLOGO (/ actApp actDoc actSpace folderList resetList Path dlg_id fn pt search_list item b ) (defun *error* (s)(princ " error: ")(princ s)(princ)) ;;; will use this when inserting block (setq actApp (vlax-get-acad-object) actDoc (vla-get-activedocument actApp)) ;;; retrieve the current / active space (model or paper) (if (= (getvar 'tilemode) 1) (setq actSpace (vla-get-ModelSpace actDoc)) (setq actSpace (vla-get-PaperSpace actDoc)) ) ;;; *** change to your own path (setq Path "d:\\Temp\\Lisp\\Cad-tutor\\Charpzy\\dwgs\\" folderList (vl-directory-files Path "*.dwg" 1) resetList folderList) ;;; give message when dialog can't be found (or create it automaticaly) (if (not (setq fn (findfile "d:\\Temp\\Lisp\\Cad-tutor\\Charpzy\\LOGOS.dcl"))) (alert "Dialog LOGOS.dcl not found") (progn (setq dlg_id (load_dialog fn)) (new_dialog "LOGOS" dlg_id) (if (not (vl-consp folderList)) (setq folderlist (list "no drawings in folder"))) (start_list "folderlist") (mapcar 'add_list (mapcar 'vl-filename-base folderList)) (end_list) ;;; dont use atof but atoi for nth (action_tile "folderlist" "(setq item (nth (atoi $value) folderList))") (action_tile "search" "(setq search-string $value)") (action_tile "bt_search" "(filter)") (action_tile "bt_reset" "(reset_listbox)") (action_tile "accept" "(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") ;;; dialog return value (setq drv (start_dialog)) (cond ((= drv 1) ;;; check as much as possible and try to catch errors and report them (if (and item (setq pt (getpoint "\nInsertion point")) (not (vl-catch-all-error-p (setq b (vl-catch-all-apply 'vla-InsertBlock (list ActSpace (vlax-3D-point pt) (strcat Path item) 1.0 1.0 1.0 0.0)))))) (princ (strcat "\nInserted block " item)) (if b (princ (strcat "\n*Error: " (vl-catch-all-error-message b)))) ) ) (t (princ "\nDialog cancelled")) ) ) ) (princ) ) (defun filter ( / match result-list) (cond ((or (null search-string)(eq search-string "")) (alert "Nothing in search box")) ((not (vl-consp folderList)) (alert "no items in list box")) (t (setq match (strcase (strcat "*" search-string "*"))) (foreach x folderList (if (wcmatch (strcase x) match) (setq result-list (cons x result-list)))) (if (not (vl-consp result-list)) (alert "Computer says no : sorry no match was found") (progn (start_list "folderlist")(mapcar 'add_list (setq folderList result-list))(end_list)) ) ) ) ) (defun reset_listbox () (set_tile "search" (setq search-string "")) (start_list "folderlist")(mapcar 'add_list (setq folderList resetList))(end_list)) LOGOS :dialog { label = "Select a Logo"; : column { : boxed_row { label= "Search"; : edit_box { edit_width = 35; key = "search";} : button { key = "bt_search"; label = "Search";} : button { key = "bt_reset"; label = "Reset";} } : boxed_column { label = "Logos"; : list_box { height = 10; width = 35; key = "folderlist"; multiple_select = false ;} } } spacer; ok_cancel; }
    2 points
  2. Or simply: (setq ss2 (ssget "_X" ((0 . "INSERT,*TEXT") (8 . "LAYER1,LAYER2,LAYER3"))))
    2 points
  3. You need to use Logical Operators http://lee-mac.com/ssget.html#logical (setq ss2 (ssget "_X" '((-4 . "<OR") (0 . "INSERT") (0 . "*TEXT") (-4 . "OR>") (8 . "LAYER1,LAYER2,LAYER3")))
    1 point
  4. V1.5 is the latest version of this application - the image of the dialog interface shown in that earlier post was created by that user and is not a real program.
    1 point
×
×
  • Create New...