Leaderboard
Popular Content
Showing content with the highest reputation on 01/04/2024 in all areas
-
I still believe making a mnu is the way to go they are so easy to make, you can have hundreds of lisps at your mouse click, they can be loaded and ran, this is what the line would look like in the mnu file ^c^c(load "11") 11 ***MENUGROUP=NIKON ***POP20 **CADLIB [->LISP1 A-B] [11]^c^c(load "11") 11 [1/4 POINTS]^C^C(LOAD "1-4 POINTS") [Add 2 Level]^C^C(LOAD "add-to-levels") [Add-pits-drain]^C^C(LOAD"Add-pits-drain") [Allbylayer]^C^C(LOAD "Allbylayer") [Apndtext]^C^C^p(LOAD "apndtext") [Apparent int]^C^C^p(LOAD "apparent int") [Area-label]^C^C^p(LOAD "area-label") [Areaobj]^C^C^p(LOAD "AREAOBJ") [ARD layers]^C^C^Parduv7aclayerlistroadslocalnew [AttFind]^C^C^p(LOAD "AttFind") [average ht]^C^C^p(LOAD "average ht") [Batterticks]^C^C^p(load "batterticks") TBL [Blay]^C^C^p(LOAD "blay") [Blockrot]^C^C^p(LOAD "BLCKROT") [Blockscale]^C^C^p(LOAD "Blckscle") [Break path]^C^C^p(LOAD "Break path") dpath [<-] [->LISP2 C-D]3 points
-
A quick look at the AutoCAD help pages suggest that Mechanical 2024 edition has some translation ability, limited to about 20 languages, including Spanish. Note that this is the first Translation in AutoCAD so will be 'basic' the next versions after user feedback will be better. There are third party add-in software packages, probably paid for. These are listed in the help pages. As for LISP, not directly. You'd need to link this to a web host for the translation. A simpler method, not as user friendly, might be to copy the text to the clipboard (LISP can do this), and manually paste into a web translation service, copy the result and then paste back into the text. LISP can help with the copy original text and paste translated text. If using a web based translation service they might not have all the technical terms, abbreviations and so on that we use so would need checking.1 point
-
Hey Steve P: Thanks! I figured out the problem was I had "normal" as a parameter in the function parameter list - apparently can't use it twice. That was the reason for the error. Now I'm on my way on this again.1 point
-
Here is some entmake samples. But starting out it may still be easier to use Command. I am sorry don't know where I got it from. Others may add more common functions. You need to have a basic understanding about the use of dxf codes. entmake functions.lsp1 point
-
You can always ask away for advice if you need it - it is more satisfying to guide someone and they learn than just dumping code in here to be copied blindly - so we're more than happy usually to give advice and guidance. Have a great year next year.1 point
-
I had started to work on kinda getfolder with options , including dynamic input , but added to many options to fast and code at this moment is in a sorry state (I messed it up). But haven't been able to do any lisp for the last couple of months , maybe next year I'll have (hopefully in a positve way) more time.1 point
-
I've updated the version I was putting together with code from your dynamic input function. Mine was mostly based on Filter List Box from Lee Mac. (defun keyfilterlistbox ( msg lst mtp / _addlist _gnum _quicksearch dch dcl des rtn sel tmp pressed key-lst1 key-lst2 LM:escapewildcards stringp) ;; Filter List Box with key input ;; ;; Combined code from: ;; Filtered List Box - Lee Mac http://www.lee-mac.com/filtlistbox.html ;; Dynamic Input - rlx https://www.cadtutor.net/forum/topic/78410-rlx-dip-dynamic-input ;; Escape Wildcards - Lee Mac http://www.lee-mac.com/escapewildcards.html ;; Putting it together - dexus https://www.cadtutor.net/forum/topic/78410-rlx-dip-dynamic-input/#comment-626261 ;; ;; Displays a list box interface from which the user may select one or more items. ;; Includes a filter when the user types to enable the user to filter the displayed list of items. ;; msg - [str] List box dialog title ;; lst - [lst] List of strings to display in the list box ;; mtp - [bol] T=Allow multiple items; nil=Single item selection ;; Returns: [lst] List of selected items, else nil (defun _addlist ( key lst ) ; By Lee Mac (start_list key) (foreach x lst (add_list x)) (end_list) lst ) ;; generate number (_gnum 1 5) -> '(1 2 3 4 5) by rlx (defun _gnum (s e / i l) (and (numberp s) (numberp e) (setq i s) (while (<= i e) (setq l (cons i l) i (1+ i)) ) ) (reverse l) ) (defun _quicksearch (key) (setq pressed (cond ((stringp pressed) (if (= key "bksp") (substr pressed 1 (1- (strlen pressed))) (strcat pressed key) ) ) ((= key "bksp") "") (key) ) flt (strcat (LM:escapewildcards (strcase pressed)) "*") sel (if tmp (mapcar (function (lambda ( n ) (nth n tmp))) (read (strcat "(" rtn ")"))))) (_addlist "lst" (setq tmp (vl-remove-if-not (function (lambda ( x ) (wcmatch (strcase x) flt))) lst))) (set_tile "lst" (setq rtn (vl-string-trim "()" (vl-princ-to-string (cond ((vl-sort (vl-remove nil (mapcar (function (lambda ( x ) (vl-position x tmp))) sel)) '<)) ('(0)) ) ) ) ) ) (set_tile "text" (strcat "Filter: " pressed)) (mode_tile "hidden_space" 2) ) ;; Check of variable een string is (defun stringp (str) (= (type str) 'str) ) ;; Escape Wildcards - Lee Mac ;; Escapes wildcard special characters in a supplied string (defun LM:escapewildcards ( str ) (if (wcmatch str "*[-#@.*?~`[`,]*,*`]*") (if (wcmatch str "[-#@.*?~`[`,]*,`]*") (strcat "`" (substr str 1 1) (LM:escapewildcards (substr str 2))) (strcat (substr str 1 1) (LM:escapewildcards (substr str 2))) ) str ) ) (if (and (setq dcl (vl-filename-mktemp nil nil ".dcl")) (setq des (open dcl "w")) (setq key-lst1 (vl-remove 34 (_gnum 33 67))) ; create key codes (setq key-lst2 (vl-remove 92 (append (_gnum 68 95) (_gnum 123 125)))) (write-line (strcat "hidden:image_button{" " width=0.1;" " height=0.1;" " fixed_width=true;" " boxed=false;" " allow_accept=true;" " color=-15;" "}" "keyfiltlistbox:dialog { label = \"" msg "\"; spacer;" ": list_box { key = \"lst\"; width = 50; fixed_width = true; height = 15; fixed_height = true; allow_accept = true; " " multiple_select = " (if mtp "true" "false") "; }" " :row{alignment=centered;" " :text{fixed_width_font=true;width=30;height=1.2;key=\"text\";label=\"Filter:\";}" " }" " :row{" (apply 'strcat (mapcar ; Eerste gedeelte van filter knoppen (function (lambda (n) (strcat ":hidden{key = \"hidden" (chr n) "\"; label = \"&" (chr n) "\";}"))) key-lst1 ) ) " }" "ok_cancel;" " :row{" (apply 'strcat (mapcar ; Tweede gedeelte van filter knoppen (function (lambda (n) (strcat ":hidden{key = \"hidden" (chr n) "\"; label = \"&" (chr n) "\";}"))) key-lst2 ) ) " :hidden {key=\"hidden_space\";}" " :hidden {label=\"&\010\";key=\"hidden_bksp\";}" " :hidden {label=\"&\\\\\";mnemonic=\"\\\\\";key=\"hidden_bksl\";}" " :hidden {label=\"&\\\"\";mnemonic=\"\\\"\";key=\"hidden_qmrk\";}" " }" "}" ) des ) (not (close des)) (< 0 (setq dch (load_dialog dcl))) (new_dialog "keyfiltlistbox" dch) ) (progn (_addlist "lst" (setq tmp lst)) (set_tile "lst" (setq rtn "0")) (setq pressed "") (foreach n (append key-lst1 key-lst2) (action_tile (strcat "hidden" (chr n)) (strcat "(_quicksearch \"" (chr n) "\")")) ) (action_tile "hidden_bksp" "(_quicksearch \"bksp\")") (action_tile "hidden_bksl" "(_quicksearch \"\\\\\")") (action_tile "hidden_qmrk" "(_quicksearch \"\\\"\")") (action_tile "hidden_space" "(_quicksearch \" \")") (mode_tile "hidden_space" 2) (set_tile "flt" "*") (action_tile "lst" "(setq rtn $value)") (action_tile "flt" (vl-prin1-to-string '(progn (setq flt (strcat "*" (LM:escapewildcards (strcase $value)) "*") sel (mapcar (function (lambda ( n ) (nth n tmp))) (read (strcat "(" rtn ")")))) (_addlist "lst" (setq tmp (vl-remove-if-not (function (lambda ( x ) (wcmatch (strcase x) flt))) lst))) (set_tile "lst" (setq rtn (vl-string-trim "()" (vl-princ-to-string (cond ((vl-sort (vl-remove nil (mapcar (function (lambda ( x ) (vl-position x tmp))) sel)) '<)) ('(0)) ) ) ) ) ) ) ) ) (mode_tile "flt" 2) ; Select filter box (setq rtn (if (and (= 1 (start_dialog)) tmp) (mapcar (function (lambda ( x ) (nth x tmp))) (read (strcat "(" rtn ")"))) ) ) ) ) (if (< 0 dch) (setq dch (unload_dialog dch)) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) rtn ) (defun c:ll (/ lst def lay) ;; Change layer - dexus ;; Example program for Filter List Box with key input (while (setq def (tblnext "layer" (not def))) (setq lst (cons (cdr (assoc 2 def)) lst)) ) (if (setq lay (car (keyfilterlistbox "Select a Layer" (acad_strlsort lst) t))) (progn (setvar 'clayer lay) (princ (strcat "\nChosen layer: " lay)) ) ) (princ) )1 point
-
Another method: (defun c:FSum2 (/ Units Prec FldStr pt ss) ;; Lee Mac ~ 12.01.10 (vl-load-com) (setq Units 2 Prec 3) ;; Accuracy (setq doc (cond (doc) ((vla-get-ActiveDocument (vlax-get-Acad-Object))))) (setq FldStr "%<\\AcExpr \(") (if (and (ssget '((0 . "TEXT,MTEXT"))) (setq pt (getpoint "\nSelect Point for Field: "))) (progn (vlax-for obj (setq ss (vla-Get-ActiveSelectionSet doc)) (setq FldStr (strcat FldStr "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-ObjectId Obj)) ">%).TextString>% +"))) (vla-Delete ss) (vla-AddMText (vla-get-ModelSpace doc) (vlax-3D-point pt) 0. (setq FldStr (strcat (substr FldStr 1 (1- (strlen FldStr))) "\) \\f \"%lu" (itoa Units) "%pr" (itoa Prec) "\">%"))))) (princ))1 point
-
Try this: ;; TEXT SUM TO FIELD ;; (defun c:Fsum (/ lst pt ss) (vl-load-com) (prompt "\nSelect text to add numbers.") (if (setq ss (ssget '((0 . "TEXT,MTEXT")))) (progn (setq pt (vlax-3D-Point (getpoint "\n Select Point: "))) (setq lst (strcat "%<\\AcExpr \(" (vl-string-right-trim "+" (apply 'strcat (mapcar '(lambda (x) (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa x) ">%).TextString>% +" ) ) (mapcar 'vla-get-objectid (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) ) ) ) ) ) "\)>%" ) ) (vla-addMText (vla-get-modelspace (vla-get-ActiveDocument (vlax-get-acad-object) ) ) pt 0.0 lst ) ) ) ;(princ lst) (princ) ) ;; ;;WIZ_12JAN10 Nice code btw Wiz1 point