Hi ALL,
Does anyone know how to override the text in dimension?
For example, replace the default dimension value with the text of "Wall to Wall".
Your helps are much appreciated.
|
|
|
Hi ALL,
Does anyone know how to override the text in dimension?
For example, replace the default dimension value with the text of "Wall to Wall".
Your helps are much appreciated.
I don't quite understand your question, or I do but it's simple :
Code:(defun c:dimwall ( / edim) (vl-load-com) (setq edim (vlax-ename->vla-object (car (entsel "\Select dimension to replace value"))) ) (vla-put-TextOverride edim "Wall to Wall") (princ) )
(vlax-ename->vla-object nil)
Consider this example:
Code:(defun c:DTOR () (c:DimTextOverride)) (defun c:DimTextOverride ( / ss textString) (princ "\rDIMENSION TEXT OVERRIDE ") (vl-load-com) (if (and (setq ss (ssget '((0 . "DIMENSION")))) (setq textString (getstring T "\nEnter override text, <Enter> to remove override: "))) (progn (vla-startundomark (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))) (vlax-for oDim (setq ss (vla-get-activeselectionset *activeDoc*)) (vla-put-textoverride oDim textString)) (vla-delete ss) (vla-endundomark *activeDoc*)) (prompt "\n** Nothing selected ** ")) (princ))
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Here's one I did last month for someone...
DosLib isn't required (just my subroutine), but if you have it loaded, it's a bit nicer since it loads by the cursor position instead of the screen center.
Fill the 'lst' variable with whatever you like.
Code:(defun c:DQE (/ lst ss str i) ;; Alan J. Thompson, 04.21.11 (setq lst '("<>" "± VIF" "EQ." "± VERIFY")) (if (and (setq ss (ssget "_:L" '((0 . "*DIMENSION*")))) (setq str (if dos_popupmenu (dos_popupmenu lst) (car (AT:ListSelect "Select dimension override:" "" 10 10 "false" lst)) ) ) (or (eq (type str) 'STR) (setq str (nth str lst))) ) (repeat (setq i (sslength ss)) (entmod (list (cons 1 str) (cons -1 (ssname ss (setq i (1- i)))))) ) ) (princ) ) (defun AT:ListSelect (title label height width multi lst / fn fo d item f) ;; List Select Dialog (Temp DCL list box selection, based on provided list) ;; title - list box title ;; label - label for list box ;; height - height of box ;; width - width of box ;; multi - selection method ["true": multiple, "false": single] ;; lst - list of strings to place in list box ;; Alan J. Thompson, 09.23.08 / 05.17.10 (rewrite) (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w")) (foreach x (list (strcat "list_select : dialog { label = \"" title "\"; spacer;") (strcat ": list_box { label = \"" label "\";" "key = \"lst\";") (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";") (strcat "width = " (vl-princ-to-string width) ";") (strcat "multiple_select = " multi "; } spacer; ok_cancel; }") ) (write-line x 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 ) ) )
Thanks to everyone's help.
Much appreciated.
MR's one is what I am looking for.
RenderMan & Alan's give options to the user to enter various inputs, which are even better.
I will look into it and learn.
Thanks again.
Hey Alan, Thanks for your routine. I have tried to change it so that there is an option for a "typical" text that shows underneath the dimension. I usually open up the properties pallete and and in the text override section I put <>\X(TYP.). But when I put it in your code. the slash doesn't carry over. any suggestions on how to get this to work?
Here is what I changed...
Code:(defun c:DQE (/ lst ss str i) ;; Alan J. Thompson, 04.21.11 (setq lst '("<>" "<>\X(TYP.)" "EQ." "± VERIFY")) ;;;< < < < The change is in this line < < < < (if (and (setq ss (ssget "_:L" '((0 . "*DIMENSION*")))) (setq str (if dos_popupmenu (dos_popupmenu lst) (car (AT:ListSelect "Select dimension override:" "" 10 10 "false" lst)) ) ) (or (eq (type str) 'STR) (setq str (nth str lst))) ) (repeat (setq i (sslength ss)) (entmod (list (cons 1 str) (cons -1 (ssname ss (setq i (1- i)))))) ) ) (princ) )
Hi Greg,
Haven't properly looked over the code, but remember that "\" will need to be "\\" in LISP, otherwise it is interpreted as an escape character.
Cool !! Works perfectly now
Thanks guys
see ya back at the swamp