Search the Community
Showing results for tags 'prefix'.
-
I've looked around and have found Suffix/Prefix routines for Text, Mtext and Attributes. I thought it would be easy to modify one of those to work with dimensions but easier said than done. I cannot figure it out. I was hoping one of these two routines would be easy to rework to work with dimensions. For this first one, I thought adding DIMENSION to the associative list would work but my understanding is limited evidently... My desire is to add a prefix/suffix to multiple dimensions. As far as dimensions are concerned does (0 . "DIMENSION") cover them all? (defun c:ftxt(/ cMod cStr tSet) (vl-load-com) (initget 1 "Prefix Suffix") (setq cMod(getkword "\nAdd [Prefix/Suffix]: ")) (if(and (setq cStr(getstring T "\nSpecify string: ")) (setq tSet(ssget '((0 . "TEXT,MTEXT")))) ;Adding DIMENSION didn't work for me ); and (foreach tx(mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr(ssnamex tSet)))) (if(= "Prefix" cMod) (vla-put-TextString tx (strcat cStr(vla-get-TextString Tx))) (vla-put-TextString tx (strcat(vla-get-TextString Tx)cStr)) ); end if ); end foreach ); end if (princ) ); end of c:ftxt The other routine I thought would be easy was this one... (defun c:test ( / as el en i ss str typ ) (initget "Prefix Suffix") (setq typ (cond ((getkword "\nAdd Prefix or Suffix? [Prefix/Suffix] <Prefix>: ")) ("Prefix"))) (setq str (getstring t (strcat typ " to Add: "))) (if (setq ss (ssget '((0 . "INSERT") (66 . 1)))) (repeat (setq i (sslength ss)) (setq en (ssname ss (setq i (1- i)))) (while (eq "ATTRIB" (cdr (assoc 0 (setq el (entget (setq en (entnext en))))))) (setq as (cdr (assoc 1 el))) (if (eq "Prefix" typ) (if (not (wcmatch as (strcat str "*"))) (entmod (subst (cons 1 (strcat str as)) (assoc 1 el) el)) ) (if (not (wcmatch as (strcat "*" str))) (entmod (subst (cons 1 (strcat as str)) (assoc 1 el) el)) ) ) ) ) ) (princ) ) Help please!! Big thanks to the original code writers!
- 29 replies
-
- dimensions
- prefix
-
(and 1 more)
Tagged with:
-
I have multiple layout tabs in a single drawing. I want to add use-given prefix to them so when i use publish command, i can segregate them properly thru its prefix. I searched the forum and i cannot find anything. Can somebody help me?
-
Help: Auto Number Layouts By its sequence and prefix it if < 10
homasa posted a topic in AutoLISP, Visual LISP & DCL
Hello Again I found this script that i wanna change because it does not work well when layouts are not "Layout 1", "Layout 2" , etc even for example if i already have the layouts numbered but have to create another one or simply re-arrange them (alert "Use at command line to execute program:\n\n numlay") (defun c:numlay (/ i) (vl-load-com) (setq i 0) (foreach x (layoutlist) (vla-put-name (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)) ) x ) (strcat (itoa (setq i (1+ i)))) ) ) (princ) ) I wanna it to : 1) Auto-number Layout using the sequence in which they really are 2) That autonumbering prefix an 0 before the number if it is this last topic i tryied using this code without sucess .... (cond ((and (> i 0) (< i 10)) (strcat "0" (itoa i)) ) thx in advanced- 13 replies
-
- autonumber
- layout
-
(and 3 more)
Tagged with:
-
Hello all. I have a routine that enters data labels in a drawing where the user would like them. It finds data in a file and inserts it based on the label number the user inputs. However, for the data labels that we enter that have no information, but the user still wants that label called out, it simply enters "#50.00-0.00". I was able to remove the "0.00" suffix because it was obvious in the code. But I would also like to remove ".00" immediately after the data label, and this isnt working out in my favor. The only thing that I would like displayed is "#50-". No decimals and no zeros. I have included the routine. and snap shot of the data labels. With the original on bottom. The current in the middle. And the goal data label I am looking for on top. Hope this helps and plenty thanks in advance. (defun c:DTEST (/ *ERROR* oldlayr p1 p2 DPNUM) (defun *error* (msg) (if oldlayr (setvar "clayer" oldlayr)) (if oldos (setvar "osmode" oldos)) (if msg (prompt msg)) (princ) ) (defun getdpnum () (if (= dpnum nil) (setq dpnum (getreal "\nEnter STARTING datapoint number (1.00-999.99): ")) (setq dpnum (+ dpnum 1))) ) (WHILE (setq oldos (getvar "osmode")) (setq oldlayr (getvar "clayer")) (command "._-layer" "s" DATAPOINT "") (initget 1) (setq p1 (getpoint "\nSelect datapoint location on pipe: ")) (setvar "osmode" 0) (initget 33) (setq p2 (getpoint p1 "\nSelect datapoint label location: ")) (getdpnum) (get_info "DATAPOINTS" "END DATAPOINTS" DPINFO "#" "-") (command "._-layer" "s" oldlayr "") (setvar "OSMODE" OLDOS) ) (*error* nil) (prin1))
-
Hi, Task 1: I need help on adding prefix to an attribute tag named ITEM_NUMBER but dont want to increment. Below is a code from Lee Mac that has prefix + increment and I tried to manipulate it but was unsuccessful. Could some one help me please? Also, prefix would change between different drawings. So, if its asks for prefix, would be great. Task #2 The ultimate goal is that once I add prefix to item number, I will copy this and modify to add prefix to BALIN tag (which is a balloon). This way I will have same prefix+number for the ITEM_NUMBER and BALIN tags. Task #3 Once this is done, and everything arranged on the drawing, I would like a utility to renumber the item numbers by removing prefix and re-incrementing it. And while doing that, It should changes at both places at once (since the prefix + number are exact both places). The tricky thing here is that multiple balloon could reference the same number since that part could be used at multiple places. Not sure if this sounds feasible? But if it does, It will save a big time headache for me since some of my drawings have about 50+ items and balloon which needs to be arranged. (defun c:incatt ( / tag pre ss1 ) (vl-load-com) (setq tag "ADDRESS" pre "ADDRESS: ") (if (setq *num* (cond ( (getint (strcat "\nSpecify Starting Number" (if *num* (strcat " <" (itoa *num*) "> : ") ": ")))) ( *num* ))) (while (setq ss1 (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1)))) (if (vl-some (function (lambda ( x ) (if (eq tag (vla-get-tagstring x)) (not (vla-put-textstring x (strcat pre (itoa *num*)))) ) ) ) (vlax-invoke (vlax-ename->vla-object (ssname ss1 0)) 'getattributes) ) (setq *num* (1+ *num*)) (princ (strcat tag " Attribute not found.")) ) ) ) (princ) )