Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/10/2023 in all areas

  1. A co-worker showed me this trick. Select a batch of text objects that you want to turn into mtext. Important: unselect them by pressing Esc. Pull up the text2mtext command from the Express menu. You'll get a prompt that includes the SEttings option; type SE. Uncheck the box for "Combine into a single mtext object" (I had never seen this before). Back at the command prompt, type P to select the Previous selection set. Press Enter and Ta-Da! all those single text items are single mtext items. You can give them frames or background masks or whatever.
    1 point
  2. The catch there is, once you have a selection set, you don't get the option to change the settings when you run the command. Maybe it's a noun/verb thing? Edit: Another catch: whatever justification your text had before, it becomes Top Left/Center/Right. In other words, if your text was Bottom Left or Middle Left, and you convert it this way, the resulting mtext object will have Top Left justification.
    1 point
  3. You want a one time password entry? I think you'll have to look into creating a registry key and reading that to check if a password has been used. Note that if you read or modify the wrong thing you can change other settings so make sure what you use is unique it isn't something I do, but others out there could help The other option is one level less secure but perhaps easy to implement, and that is to save a small text file on the users machine containing some text (such as 'password OK") which if the file exists then the LISP can run, and if it doesn't exist, ask for the password. This file could be anywhere of course and if the coding is in the compiled code tricky to find by casual looking.
    1 point
  4. Hi, Try this! (defun c:cut_line ( / js_all js_h js_v tmp_js tmp_lst lst_exth lst_extv nb_all name_ent dxf_ent dxf_10 dxf_11 gap nb_v lst_pt_brk v_name dxf_entv lst_int lst_pt_make) (princ "\nSelect lines to cut vertical or horizontal lines: ") (setq js_all (ssget '((0 . "LINE"))) js_h (ssadd) js_v (ssadd) lst_exth nil lst_extv nil) (cond (js_all (repeat (setq nb_all (sslength js_all)) (setq name_ent (ssname js_all (setq nb_all (1- nb_all))) dxf_ent (entget name_ent) dxf_10 (cdr (assoc 10 dxf_ent)) dxf_11 (cdr (assoc 11 dxf_ent)) ) (cond ((equal (cadr (trans dxf_10 0 1)) (cadr (trans dxf_11 0 1)) 1E-5) (setq js_h (ssadd name_ent js_h) lst_exth (cons (list dxf_10 dxf_11) lst_exth)) ) ((equal (car (trans dxf_10 0 1)) (car (trans dxf_11 0 1)) 1E-5) (setq js_v (ssadd name_ent js_v) lst_extv (cons (list dxf_10 dxf_11) lst_extv)) ) ) ) ) ) (cond ((and js_h js_v) (initget "Vertical Horizontal") (if (eq (getkword "\nCut with [Vertical/Horizontal] lines? <Horizontal>: ") "Vertical") (setq tmp_js js_h tmp_lst lst_exth js_h js_v lst_exth lst_extv js_v tmp_js lst_extv tmp_lst ) (setq tmp_js nil tmp_lst nil) ) (initget 4) (setq gap (getreal (strcat "\nEnter the gap? <" (rtos (getvar "DIMEXO")) ">: "))) (if gap (setvar "DIMEXO" gap)) (repeat (setq nb_v (sslength js_v)) (setq lst_pt_brk nil v_name (ssname js_v (setq nb_v (1- nb_v))) dxf_entv (entget v_name) dxf_10 (cdr (assoc 10 dxf_entv)) dxf_11 (cdr (assoc 11 dxf_entv)) lst_int (vl-remove nil (mapcar '(lambda (x) (inters dxf_10 dxf_11 (car x) (cadr x) T)) lst_exth)) ) (foreach xint lst_int (if (member xint (apply 'append (if tmp_lst lst_exth lst_extv))) (setq lst_int (vl-remove xint lst_int)) ) ) (cond (lst_int (mapcar '(lambda (el) (setq lst_pt_brk (cons (polar el (+ (atan (/ (cadr (getvar "UCSXDIR")) (car (getvar "UCSXDIR")))) (if tmp_js 0 (* pi 0.5))) (getvar "DIMEXO" )) (cons (polar el (+ (atan (/ (cadr (getvar "UCSXDIR")) (car (getvar "UCSXDIR")))) (if tmp_js pi (* pi 1.5))) (getvar "DIMEXO" )) lst_pt_brk ) ) ) ) lst_int ) (setq lst_pt_make (vl-sort (cons dxf_11 (cons dxf_10 lst_pt_brk)) '(lambda (e1 e2) (if tmp_js (< (car e1) (car e2)) (< (cadr e1) (cadr e2)))))) (while lst_pt_make (entmake (list (assoc 0 dxf_entv) '(100 . "AcDbEntity") (assoc 67 dxf_entv) (assoc 410 dxf_entv) (assoc 8 dxf_entv) (if (assoc 62 dxf_entv) (assoc 62 dxf_entv) '(62 . 256)) (if (assoc 6 dxf_entv) (assoc 6 dxf_entv) '(6 . "BYLAYER")) (if (assoc 48 dxf_entv) (assoc 48 dxf_entv) '(48 . 1.0)) (if (assoc 370 dxf_entv) (assoc 370 dxf_entv) '(370 . -1)) '(100 . "AcDbLine") (cons 10 (car lst_pt_make)) (cons 11 (cadr lst_pt_make)) (assoc 210 dxf_entv) ) ) (setq lst_pt_make (cddr lst_pt_make)) ) (entdel v_name) ) ) ) ) ) (prin1) )
    1 point
  5. I have always taken approach of the end user having some skill and understanding what the code is doing, hence a simplified answer. You could add a UNDO back setting so if done wrong will undo all changes. Getting a full automation of If and Buts is extremely difficult some times and as code is provided free not on the high To do List. The code takes like 2 seconds to use with a bit of care so still way quicker than a Manual Break. At some stage must have time for a sip of coffee. I am glad though its working. (command "._undo" "_mark") ..... code (command "._undo" "_end") if you type UNDO then B will undo back to mark
    1 point
  6. Like others doing something, there is an alternative to breaking the lines and that is to use a wipeout and play with draw order. The advantage is that the line is not broken but appears to to be. Can do something if that is helpful. Another attempt, select cut P/lines, then select P/lines to break. ; Break p/lines at intersection ; By AlanH April 2023 (defun c:wow ( / x y ss1 ss2 obj1 obj2 obj intpt inpts) (setq oldsnap (getvar 'osmode)) (prompt "Select cut lines ") (setq ss1 (ssget '((0 . "LWPOLYLINE,LINE")))) (princ "\n") (prompt "Select break lines ") (setq ss2 (ssget '((0 . "LWPOLYLINE,LINE")))) (setvar 'osmode 0) (repeat (setq x (sslength ss1)) (setq obj1 (vlax-ename->vla-object (ssname ss1 (setq x (- x 1))))) (repeat (setq y (sslength ss2)) (setq obj2 (vlax-ename->vla-object (ssname ss2 (setq y (- y 1))))) (setq intpt (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity)) (if intpt (progn (command "circle" intpt 4) ; can add a set gap (setq obj (vlax-ename->vla-object (entlast))) (setq intpts (vlax-invoke obj2 'intersectWith obj acExtendThisEntity)) (entdel (entlast)) (command "break" (list (car intpts)(cadr intpts)) (list (nth 3 intpts)(nth 4 intpts))) ) ) ) ) (setvar 'osmode oldsnap) (princ) ) (c:wow)
    1 point
  7. In this LISP you are creating a CSV file, comma separated data, which as far as LISP is concerned is just a text file - and knowing this helps you along the way/ To modify or create a text file the LISP uses the command "write-line" to well, write each line of the text / CSV file For example, your header row is created using this: (write-line "HANDLE,LENGTH,LAYER,X,Y,Z" F) You could modify that line to be: (write-line "HANDLE,LENGTH" F) So look through the rest of the code for all the "write-lines" These all have the format: (copying the line before as well) (setq tmp (strcat txt (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) ",0.0")) (write-line tmp f) "write-line tmp f" writes the variable tmp to the text file. Looking at tmp, strcat is like excel concatenate, joins text strings together, so tmp is the variable txt, and some stuff done to variable pnt - which I guess is 'point' So go back up the code a bit, txt is defined once: (setq txt (strcat han "," len "," lyr ",")) So what to do..... Modify the header row as above. "Handle,Length" and just before the (write-line tmp f) line just put (setq tmp txt), noting I also comment out (add ;;) the original setq tmp line - just so you can go back to the original if needed ;; (setq tmp (strcat txt (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) ",0.0")) (setq tmp txt) (write-line tmp f) Right now adding in the count. You'll want to set a counter somewhere in this. the code has a 'repeat' command, perhaps before then put in a line such as (setq acount 0) Then the first line after repeat increment this as you want (setq acount (+ acount 10)) then work out how to modify the header to show the acount (look earlier in this answer), and also how to add this to the correct part of the variable tmp (perhaps looking at the strcat line above for a hint) see how that works and ask again if you need more info.... long weekend break here so no CAD nut I can give you hints rather than a finished LISP
    1 point
  8. Ok with LT all manual no automation ! Don't know about wether diesel can be used. Using a lisp can pull apart the dim text value based on 4 decimal places and superscript last 2 decimal places. LT 2024 now supports lisp. So does Bricscad, Intellicad, Zwcad, Gstar, Drafsight to mention a few.
    1 point
  9. No need for the first part of selecting text, just type SE after starting the TXT2MTXT command (or hit the down arrow) to bring up SEttings. You'll need to remember to reset the combine option if needed later.
    1 point
×
×
  • Create New...