Search the Community
Showing results for tags 'suffix'.
Found 5 results
LISP to add predefined Suffix to dimension
K Baden posted a topic in AutoLISP, Visual LISP & DCLGood morning! I have not had any luck in finding much that my novice LISP skills can fix up to suit my needs. Perhaps someone here has something laying around? I am looking to have a LISP that does the following: allows the user to select one or more dimensions Allows user to pick from 3-4 options with the underlined letter being what the command needs: (XHM), (THR), (YJM), and (CPA) Then add the user selected string as a dimension suffix to the selected dimension. We add suffixes to dimensions often, and there are several different ones we use daily. Just looking to save time by having a command that will add the selected string to the suffix. Does anyone have anything similar? I am able to do some editing to suit my needs, but I don't even know where to start with editing a dimension suffix via LISP. Thanks in advance!
Removing Decimals in an existing routine.
tmelancon posted a topic in AutoLISP, Visual LISP & DCLHello 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))
Batch append same suffix to multiple unique mtexts?
WindowsIHateYou posted a topic in AutoLISP, Visual LISP & DCLI have ALMOST 1000 unique mtexts. I want to append a second line, with the same text, to ALL of them at once. All the current mtexts are different, with different character lengths, so I cannot use 'find and replace'. However, they are are all on the same layer and easily selectable as a group. Is there an easy way to do this? Lisp or otherwise? i.e. originals: "12345" "abcde" "..." desired results: "12345 HOUSE" "abcde HOUSE" "... HOUSE" Thanks
lsp help for saving a copy of all opened dwgs to specified folder with suffix no.++!
jamesfui posted a topic in AutoLISP, Visual LISP & DCLhi.. need help on creating lsp that can: > save out a copy each on all opened dwgs to specified folder with suffix increase as per existing by next number! example; ``````` Currently opened dwgs: abc.dwg , def.dwg , ghi.dwg , etc.dwg when the command function is execute, it will create a copy each in specified folder same as the above opened filenames with a suffix added as shown below; c:\documents & settings\user\backup\abc_1.dwg c:\documents & settings\user\backup\def_1.dwg c:\documents & settings\user\backup\ghi_1.dwg if the second time of the command function is execute, it will save another copy with increment of 1 as per existing filename as shown below; c:\documents & settings\user\backup\abc_2.dwg c:\documents & settings\user\backup\def_2.dwg c:\documents & settings\user\backup\ghi_2.dwg thanks
Add Prefix/Suffix to Multiple Dimensions?
ILoveMadoka posted a topic in AutoLISP, Visual LISP & DCLI'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!