darshjalal Posted Monday at 07:55 AM Posted Monday at 07:55 AM Good day I would like to share this lisp for anyone need it Regards extcoord-extract_coords of anything -REV20.lsp 1 Quote
BIGAL Posted Monday at 11:41 PM Posted Monday at 11:41 PM A few comments. You have not put your name and date to code, say add at that start. You can write direct to Excel rather than opening a csv. Can help with that. You can replace the Initget with the attached. Multi radio buttons.lsp Other methods available also. Same with the "point markers" Multi toggles.lsp Also for input values strings or numbers Multi GETVALS.lsp if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already (if (= but nil)(setq but 1)) ; this is needed to set default button (setq lst (list "Please choose" "1-Pts" "2-Pl" "3-3DPl" "4-Cir" "5-Arc" "6-Blk" "7-Ln" "8-Spl" "9-FL" "10-All")) (setq ans (ah:butts but "V" lst)) All 3 options can be made into a single DCL. 1 Quote
mhupp Posted Tuesday at 12:33 AM Posted Tuesday at 12:33 AM Beat me too it @BIGAL Another way. also a better way to set default options with getkword using cond. ;; ============================ ;; MAIN COMMAND: EXTCOORD ;; ============================ (defun c:EXTCOORD ( / ss lst fname baseName total outSel outTypes modeSel mode start-num incr i insPt insNum) (vl-load-com) (setq modeSel (car (AT:ListSelect "Export Cords From" "" 15 30 "false" (list "Point" "Polyline" "3D Polyline" "Circle" "Arc" "Block" "Line" "Spline" "Feature Line" " All of The Above")))) (setq mode (cond ((= modeSel "Point") 1) ((= modeSel "Polyline") 2) ((= modeSel "3D Polyline") 3) ((= modeSel "Circle") 4) ((= modeSel "Arc") 5) ((= modeSel "Block") 6) ((= modeSel "Line") 7) ((= modeSel "Spline") 8) ((= modeSel "Feature Line") 9) (T 10))) (setq start-num (getint "\nStart Number <1>: ")) (if (null start-num) (setq start-num 1)) (setq incr (getint "\nIncrement <1>: ")) (if (null incr) (setq incr 1)) (initget "Yes No") (setq insPt (cond ((getkword "\nInsert point markers? [Yes/<No>]: ")) ("No"))) (initget "Yes No") (setq insNum (cond ((getkword "\nShow text numbering? [<Yes>/No]: ")) ("Yes"))) (princ "\nSelect objects to export...") (if (setq ss (ssget)) (progn (setq lst '() i 0) (repeat (sslength ss) (setq lst (cons (ssname ss i) lst)) (setq i (1+ i))) (initget "CSV TXT GSI All") (setq outSel (getkword "\nExport Format [CSV/TXT/GSI/All] <All>: ")) (if (null outSel) (setq outSel "All")) (setq outTypes (cond ((= outSel "CSV") '("CSV")) ((= outSel "TXT") '("TXT")) ((= outSel "GSI") '("GSI")) (T '("CSV" "TXT" "GSI")))) (setq fname (getfiled "Save Export As (Base Name)" "" "gsi;csv;txt" 1)) (if fname (progn (setq baseName (vl-filename-directory fname) baseName (strcat baseName "\\" (vl-filename-base fname))) (setq total (process-entities (reverse lst) mode start-num incr outTypes baseName insPt insNum)) (princ (strcat "\nSUCCESS: " (itoa total) " points exported.")) (startapp "explorer" (vl-filename-directory fname)) ) ) ) (princ "\nNothing selected.") ) (princ) ) ;;----------------------------------------------------------------------------;; ;; Function to Pick form list ;; list select dialog ;; create a temp DCL multi-select list dialog from provided list ;; value is returned in list form, DCL file is deleted when finished ;; example: (setq the_list (AT:listselect "This is my list title" "Select items to make a list" "25" "30" "true" (list "object 1" "object 2" "object 3")) ;; if mytitle is longer than defined width, the width will be ignored and it will fit to title string ;; if mylabel is longer than defined width, mylabel will be truncated ;; myheight and mywidth must be strings, not numbers ;; mymultiselect must either be "true" or "false" (true for multi, false for single) ;; created by: alan thompson, 9.23.08 / 05.17.10 (rewrite) mhupp ;; some coding borrowed from http://www.jefferypsanders.com (thanks for the DCL examples) (defun AT:ListSelect (title label height width multi lst / fn fo d f) (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line (strcat "list_select : dialog { label = \"" title "\"; spacer;") fo) (write-line (strcat ": list_box { label = \"" label "\";" "key = \"lst\";") fo) (write-line (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";") fo) (write-line (strcat "width = " (vl-princ-to-string width) ";") fo) (write-line (strcat "multiple_select = " multi "; } spacer; ok_cancel; }") fo) (close fo) (new_dialog "list_select" (setq d (load_dialog fn))) (start_list "lst") (mapcar (function add_list) lst) (end_list) (setq item (set_tile "lst" "0")) (action_tile "lst" "(setq item $value)") (setq f (start_dialog)) (unload_dialog d) (vl-file-delete fn) (if (= f 1) ((lambda (s / i s l) (while (setq i (vl-string-search " " s)) (setq l (cons (nth (atoi (substr s 1 i)) lst) l)) (setq s (substr s (+ 2 i))) ) (reverse (cons (nth (atoi s) lst) l)) ) item ) ) ) Quote
darshjalal Posted Tuesday at 03:47 AM Author Posted Tuesday at 03:47 AM 4 hours ago, BIGAL said: A few comments. You have not put your name and date to code, say add at that start. You can write direct to Excel rather than opening a csv. Can help with that. You can replace the Initget with the attached. Multi radio buttons.lsp Other methods available also. Same with the "point markers" Multi toggles.lsp Also for input values strings or numbers Multi GETVALS.lsp if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already (if (= but nil)(setq but 1)) ; this is needed to set default button (setq lst (list "Please choose" "1-Pts" "2-Pl" "3-3DPl" "4-Cir" "5-Arc" "6-Blk" "7-Ln" "8-Spl" "9-FL" "10-All")) (setq ans (ah:butts but "V" lst)) All 3 options can be made into a single DCL. Thanx for the reply , I did not put my name because i did not programmed by my self, I gave Gemini AI the logic . Anyway thanx for your addition for the code. I have another codes that I have programmed by AI for many purposes I will share later if that is ok. Regards. Quote
BIGAL Posted yesterday at 12:10 AM Posted yesterday at 12:10 AM (edited) Yes Ai is being used more, but sometimes does not work, that's when you need lisp experience to work out what is wrong. But paste that you wrote it using AI still put your name to it. I would build a big DCL. Oops should have been 4 columns but you get the idea. Yes can use the list box instead of toggle buttons. Just pasted each option into one image as a guide to how it should look. Oh yeah if your using object point numbers then should include a function that finds the last object number used if your selecting single objects at a time. Edited yesterday at 12:14 AM by BIGAL 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.