Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/14/2024 in all areas

  1. A bit on the longer side, but maybe this: (defun c:fo ( / a c dir ent i pt r ss sstb txt) (cond ( (not (setq sstb (ssget "_X" (append (list '(0 . "ACAD_TABLE") '(-4 . "<OR") ) (mapcar '(lambda (a) (cons 8 (LM:escapewildcards a)) ) (JH:GetLockedFrozenOffLayers nil nil nil nil) ) (list '(-4 . "OR>") (cons 410 (if (= (getvar "cvport") 1) (getvar "ctab") "Model")) ) ) ) ) ) (princ (if (= (getvar "cvport") 1) "\nNo tables in current paper space." "\nNo tables in model space.")) ) ( (not (setq ss (ssget '((0 . "TEXT,MTEXT")))))) ( (setq sstb (JH:selset-to-list-vla sstb)) (repeat (setq i (sslength ss)) (setq i (1- i) ent (ssname ss i) txt (cons (vla-get-TextString (vlax-ename->vla-object ent)) txt) ) ) (setq txt (LM:lst->str txt " ")) (while (progn (setvar "errno" 0) (initget "Exit") (setq pt (getpoint "\nSpecify table cell [Exit] <exit>: ")) (cond ( (= (getvar "errno") 7) (princ "\nNothing selected.")) ( (member pt '("Exit" nil)) nil) ( (progn (setq pt (vlax-3d-point (trans pt 1 0)) dir (vlax-3d-point (getvar "viewdir"))) (vl-some (function (lambda (a) (if (eq (vla-hittest a pt dir 'r 'c) :vlax-true) (progn (if (not (zerop (logand accellstatecontentlocked (vla-getcellstate a r c)))) (princ "\nTable cell is locked.") (vla-settext a r c txt) ) t ) ) ) ) sstb ) ) ) ( (princ "\nNo table cell detected.")) ) ) ) ) ) ) ;; JH:GetLockedFrozenLayers --> Jonathan Handojo ;; Gets a list of layers that are locked and/or frozen. ;; lck - T to get locked layers, nil to get unlocked layers ;; frz - T to get frozen layers, nil to get thawed layers ;; off - T to get 'off' layers, nil to get 'on' layers ;; xref - T to include xref, nil to exclude xref (defun JH:GetLockedFrozenOffLayers (lck frz off xref / nm nx rtn) (while (setq nx (tblnext "layer" (null nx))) (setq nm (cdr (assoc 2 nx))) (if (not (and (not xref) (wcmatch nm "*|*"))) (if (and (or (and lck (= 4 (logand 4 (cdr (assoc 70 nx))))) (and (not lck) (zerop (logand 4 (cdr (assoc 70 nx))))) ) (or (and frz (= 1 (logand 1 (cdr (assoc 70 nx))))) (and (not frz) (zerop (logand 1 (cdr (assoc 70 nx))))) ) (or (and off (minusp (cdr (assoc 62 nx)))) (and (not off) (> (cdr (assoc 62 nx)) 0)) ) ) (setq rtn (cons nm rtn)) ) ) ) (reverse rtn) ) ;; JH:selset-to-list-vla --> Jonathan Handojo ;; Returns a list of vla objects from a selection set ;; ss - selection set (defun JH:selset-to-list-vla (ss / rtn i) (if ss (repeat (setq i (sslength ss)) (setq rtn (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) rtn)) ) ) ) ;; Escape Wildcards - Lee Mac ;; Escapes wildcard special characters in a supplied string (defun LM:escapewildcards ( str ) (vl-list->string (apply 'append (mapcar '(lambda ( c ) (if (member c '(35 64 46 42 63 126 91 93 45 44)) (list 96 c) (list c) ) ) (vl-string->list str) ) ) ) ) ;; List to String - Lee Mac ;; Concatenates each string in a supplied list, separated by a given delimiter ;; lst - [lst] List of strings to concatenate ;; del - [str] Delimiter string to separate each item (defun LM:lst->str ( lst del / str ) (setq str (car lst)) (foreach itm (cdr lst) (setq str (strcat str del itm))) str ) The selected text will be concatenated together, using spaces. You may need to select the text by picking instead of window or crossing to get the text in order.
    2 points
  2. Make Yes or no a variable then move it to the other side of / in the defun line. this means you will need to add a call like the dir variable (defun c:KeepHmirror nil (OnePointMirror '(10 00 00) "No")) ;keep source (defun c:DeleteHmirror nil (OnePointMirror '(10 00 00) "Yes")) ;delete source (defun OnePointMirror (dir del / ss pt) ;del is yes or no to delete (and (setq ss (ssget "_:L")) (setq pt (getpoint "\nSpecify base point <exit>: ")) (command "_mirror" ss "" "_non" pt "_non" (mapcar '+ dir pt) del) ;; <--- Change to Yes to delete source object, or \\ to prompt user. (while (not (zerop (getvar "cmdactive"))) (command "")) ) (princ) )
    1 point
  3. Look at the command line when you do -style manually, press F2 to see the correct input, why would you set Romans to txt.shx why not Romans. Again look at using a DWT.
    1 point
  4. Simplest way is to make your styles and save in a DWT so they are ready to go. Add all your layers, blocks and linetypes also. If you do Options Files Templates you can set your dwt to be the one that is used when you start CAD.
    1 point
  5. Every surface is saved in the drawing itself. Which is why I see drawings that are anywhere from 5 to 150 MB in size. Welcome to the forum!
    1 point
  6. 1 point
  7. It's called a background mask. The catch is that you can't apply it to a text object, only multitext. If necessary, you can use the Express tool TXT2MTXT to convert your text to multitext. Then call up the properties of that multitext and open the dialogue box for "Background mask." If it's a multileader instead of a multitext, you can turn the Background mask on and off, but you have to define the mask inside the text editor. If it's a dimension, you can specify a "Fill color," including "Background." Welcome to the forum!
    1 point
  8. (defun c:MAV (/ AT:GetSel obj ss u aLst lkLst) ;; Match Attribute Values (including objects on locked layers) ;; Alan J. Thompson, 05.25.10 (vl-load-com) (defun AT:GetSel (meth msg fnc / ent) ;; meth - selection method (entsel, nentsel, nentselp) ;; msg - message to display (nil for default) ;; fnc - optional function to apply to selected object ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC"))) ;; Alan J. Thompson, 05.25.10 (setvar 'ERRNO 0) (while (progn (setq ent (meth (cond (msg) ("\nSelect object: ") ) ) ) (cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again.")) ((eq (type (car ent)) 'ENAME) (if (and fnc (not (fnc ent))) (princ "\nInvalid object!") ) ) ) ) ) ent ) (if (and (setq obj (car (AT:Getsel entsel "\nSelect Attributed Block: " (lambda (x / e) (and (eq "INSERT" (cdr (assoc 0 (setq e (entget (car x)))))) (eq 1 (cdr (assoc 66 e))) ) ) ) ) ) (not (initget 0 "Yes No")) (setq *MAV:Choice* (cond ((getkword (strcat "\nMatch ONLY selected block \"" (vla-get-name (setq obj (vlax-ename->vla-object obj))) "\" [Yes/No] <" (cond (*MAV:Choice*) ((setq *MAV:Choice* "Yes")) ) ">: " ) ) ) (*MAV:Choice*) ) ) (setq ss (ssget (list '(0 . "INSERT") '(66 . 1) (cons 2 (if (eq "Yes" *MAV:Choice*) (vla-get-name obj) "*" ) ) ) ) ) ) (progn (setq u (not (vla-startundomark (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) ) (vlax-for la (vla-get-layers *AcadDoc*) (and (eq :vlax-true (vla-get-lock la)) (setq lkLst (cons la lkLst)) (vla-put-lock la :vlax-false) ) ) (foreach a (vlax-invoke obj 'GetAttributes) (setq aLst (cons (cons (vla-get-tagstring a) (vla-get-textstring a)) aLst)) ) (vlax-for x (setq ss (vla-get-activeselectionset *AcadDoc*)) (foreach a (vlax-invoke x 'GetAttributes) (if (setq att (cdr (assoc (vla-get-tagstring a) aLst))) (vla-put-textstring a att) ) ) ) (vla-delete ss) (and lkLst (foreach l lkLst (vla-put-lock l :vlax-true))) (and u (vla-endundomark *AcadDoc*)) ) ) (princ) )
    1 point
×
×
  • Create New...