All Activity
- Past hour
-
The pound sign wobbles textreplacer
Steven P replied to bustr's topic in AutoLISP, Visual LISP & DCL
This is what I use, I think the route LISP is the same as the OPs, over time I have added to it: txtfindreplace ;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text/td-p/5649883 (defun FindReplace (Str$ Find$ Replace$ / Cnt# FindLen# Loop Mid$ NewStr$ ReplaceLen# acount) (setq Loop t Cnt# 1 NewStr$ Str$ FindLen# (strlen Find$) ReplaceLen# (strlen Replace$) ) (setq acount 0) (while Loop (setq Mid$ (substr NewStr$ Cnt# FindLen#)) (if (= Mid$ Find$) (progn (setq acount (+ acount 1)) (setq NewStr$ (strcat (substr NewStr$ 1 (1- Cnt#)) Replace$ (substr NewStr$ (+ Cnt# FindLen#))) Cnt# (+ Cnt# ReplaceLen#) );setq );end progn (setq Cnt# (1+ Cnt#)) );if (if (= Mid$ "") (setq Loop nil)) );while (list NewStr$ acount) );defun FindReplace (defun FindReplaceNew (Find$ Replace$ / SS acounter acount ent1 entlist1 entcodes1 EntType Text$ text01 ReplaceWith$ FoundReplaced NewTxt MyBlockEntList BlockCounter ) ;;;Sub Routines ;;;; ;;;;;;;;;;;;;;;;;;;; ;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-entities-inside-a-block/td-p/2644829 (defun getblkitems ( EntName / sel items) ;;Blocks: (setq nfo (entget EntName)) (progn (vlax-for item (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object) ) ) (cdr (assoc 2 nfo)) ) (setq items (cons (vlax-vla-object->ename item) items)) ) ;end vlax ) ; end progn ) ;end defun (defun updateblock ( EntType ent1 entlist1 acount Find$ Replace$ / MyBlockEntList BlockCounter EntType2 ent2 entlist2 ) (if (= EntType "INSERT") (progn ;;Updates block texts & block blocks (setq MyBlockEntList (getblkitems ent1) ) (setq BlockCounter 0) (while (< BlockCounter (length MyBlockEntList)) (setq ent2 (nth BlockCounter MyBlockEntList)) (setq entlist2 (entget ent2)) (setq EntType2 (cdr (assoc 0 entlist2)) ) ;;Attrributes (setq acount (updateattribvalues EntType ent1 entlist1 acount Find$ Replace$)) ;;Texts (if (or (= EntType2 "TEXT")(= EntType2 "MTEXT")(= EntType2 "MULTILEADER")) ;;attributes? (setq acount (updatetext EntType2 ent2 entlist2 acount Find$ Replace$)) ); end if ;;Changes Dimensions (if (or (= EntType2 "DIMENSION") ) (if (= (cdr (assoc 1 entlist2)) "") ;;if has text over ride () (progn (setq acount (updatetext EntType2 ent2 entlist2 acount Find$ Replace$)) ;;same as text -if- ent code 4 used (command ".-refedit" (cdr (assoc 10 entlist1)) "ok" "all" "yes") ;;update block definition (command "refclose" "s") );end progn ) ;end if ); end if (if (= EntType2 "ACAD_TABLE") (setq acount (UpdateTable EntType2 ent2 entlist2 acount Find$ Replace$)) );end if (if (= EntType2 "INSERT") ;;Blocks (setq acount (updateblock EntType2 ent2 entlist2 acount Find$ Replace$)) );end if (setq BlockCounter (+ BlockCounter 1)) ) ; end while );end progn );end if acount ) ;;End Blocks ;;;;;;;;;;;;;;;;;;;; (defun updateattribvalues (EntType ent1 entlist1 acount Find$ Replace$ / ) (setq EntName^ ent1 EntList@ entlist1 EntType$ EntType Text$ (cdr (assoc 1 EntList@)) );setq (if (= EntType$ "INSERT") (if (assoc 66 EntList@) (progn (while (/= (cdr (assoc 0 EntList@)) "SEQEND") (setq EntList@ (entget EntName^)) (if (= (cdr (assoc 0 EntList@)) "ATTRIB") (progn (setq Text$ (cdr (assoc 1 EntList@))) (if (wcmatch Text$ (strcat "*" Find$ "*")) (progn (setq FoundReplaced (FindReplace Text$ Find$ Replace$)) (setq ReplaceWith$ (nth 0 FoundReplaced)) (setq acount (+ acount (nth 1 FoundReplaced))) (entmod (subst (cons 1 ReplaceWith$) (assoc 1 EntList@) EntList@)) (entupd EntName^) );progn );if );progn );end if attrib (setq EntName^ (entnext EntName^)) );while );progn );if );if acount ) ;end defun ;;;;;;;;;;;;;;;;;;;; (defun updatetext (EntType ent1 entlist1 acount Find$ Replace$ / entcodes1 FoundReplaced NewTxt) (progn (setq entcodes1 (gettextdxfcodes entlist1) ) ;list of ent codes containing text. (setq text01 (gettextasstring ent1 entcodes1) ) ;Text as string (if (= text01 nil) () (progn (setq FoundReplaced (FindReplace text01 Find$ Replace$)) (setq NewTxt (nth 0 FoundReplaced)) (setq acount (+ acount (nth 1 FoundReplaced))) (addinnewtext NewTxt entlist1 ent1) )) ;end progn, end if ) ; end progn acount ) ;;;;;;;;;;;;;;;;;;;; (defun UpdateTable ( EntType ent1 entlist1 acount Find$ Replace$ / text01 Newentlist1 counter) (setq counter 0) (setq Newentlist1 '()) (while (< counter (length entlist1)) (if (or (= (nth 0 (nth counter entlist1)) 1)(= (nth 0 (nth counter entlist1)) 302) ) (progn (setq text01 (cdr (nth counter entlist1))) (setq FoundReplaced (FindReplace text01 Find$ Replace$)) (setq NewTxt (nth 0 FoundReplaced)) (setq acount (+ acount (nth 1 FoundReplaced))) (setq text01 NewTxt) (setq Newentlist1 (append Newentlist1 (list (cons (nth 0 (nth counter entlist1)) text01)))) ) ;end progn (setq Newentlist1 (append Newentlist1 (list (nth counter entlist1)))) ;;ignore entity item ) ;end if (setq counter (+ counter 1)) ) ;end while (setq entlist1 Newentlist1) (entmod entlist1) (entupd ent1) acount ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;end subroutines 'findreplace' (setq acount 0) (setq acounter 0) (command "UNDO" "BEGIN") (setq SS (ssget "x" (list '(-4 . "<AND") '(-4 . "<OR") ;; '(-4 . "<AND") '(0 . "*TEXT") ;; '(-4 . "<OR") ;; (cons TEXTSTRING) ;; '(-4 . "OR>") ;; '(-4 . "AND>") '(0 . "INSERT") '(0 . "ATTDEF") '(0 . "ATTRIB") '(0 . "DIMENSION") '(0 . "*LEADER") '(0 . "POSITIONMARKER") '(0 . "*TABLE") '(-4 . "OR>") (cons 410 (getvar "CTAB")) '(-4 . "AND>") ))) ; end setq, end ss, end list ;;;FILTER SS to text string (while (< acounter (sslength SS)) (setq ent1 (ssname SS acounter)) (setq entlist1 (entget ent1)) (setq EntType (cdr (assoc 0 entlist1)) ) (setq Text$ (cdr (assoc 1 entlist1)) ) ;;change this line to get all texts inc. long texts etc. ;;Changes Attribute Values - In Blocks (setq acount (updateattribvalues EntType ent1 entlist1 acount Find$ Replace$)) ;;Changes Block Texts (if (= EntType "INSERT") (setq acount (updateblock EntType ent1 entlist1 acount Find$ Replace$)) );end if ;;Changes Texts (if (or (= EntType "MTEXT")(= EntType "TEXT") (= EntType "MULTILEADER") (= EntType "POSITIONMARKER") ) (setq acount (updatetext EntType ent1 entlist1 acount Find$ Replace$)) ); end if (if (or (= EntType "DIMENSION") ) (if (= (cdr (assoc 1 entlist1)) "") ;;if has text over ride () (setq acount (updatetext EntType ent1 entlist1 acount Find$ Replace$)) ;;same as text -if- ent code 4 used ) ); end if (if (or (= EntType "ATTDEF")(= EntType "ATTRIB") ) (progn (setq ent2 (entget ent1)) (setq AttText (cdr (assoc 2 ent2))) (setq FoundReplaced (FindReplace AttText Find$ Replace$)) (setq NewTxt (nth 0 FoundReplaced)) (setq acount (+ acount (nth 1 FoundReplaced))) (setq newval Replace$) (entmod (subst (cons 2 NewTxt) (assoc 2 ent2) ent2)) (entupd ent1) );end progn ); end if (if (= EntType "ACAD_TABLE") (setq acount (UpdateTable EntType ent1 entlist1 acount Find$ Replace$)) );end if (setq acounter (+ 1 acounter)) ) ; end while (command "REGEN") (command "UNDO" "END") acount );defun FindReplaceNew (defun c:txtFindReplace( / old_text new_text) (setq old_text (getstring T "OLD Text to replace (replace in this model/paper space and text case as entered): ")) (setq new_text (getstring T "NEW Text: ")) (princ "Changes: ") (princ (FindReplaceNew old_text new_text) ) (princ) ) -
I tried this as a test, so finds the #1234 text. It will find 123#456 also. But the lisp as suggested by @Steven P should cater for that. (setq ss (ssget "X" (list (cons 0 "*text")(cons 1 "*#*")))) (princ (sslength ss)) 12
-
Steven P started following The pound sign wobbles textreplacer
-
The pound sign wobbles textreplacer
Steven P replied to bustr's topic in AutoLISP, Visual LISP & DCL
For example I use a LISP find/replace if I don't want a dialogue box for example in a batch process. -
Node of Arc Length Dimension
BIGAL replied to dickeychan's topic in AutoCAD 2D Drafting, Object Properties & Interface
Welcome to Cadtutor. You can draw a rectang that represents your viewport for a given scale matching a known title block. It is a lisp program. Just pick a point in model space, the rectang can be moved and/or rotated, part 2 is make a matching layout. So can see the dim problem and make some choices. Just ask if sounds helpful. -
Blank DWG with a large file size...
BIGAL replied to lamensterms's topic in AutoCAD Drawing Management & Output
Welcome aboard last post was 11 years ago. So it could be considered a closed post. Yes if using CIV3D it locks lots of stuff in a dwg wether its used or not. PURGESTYLEANDSETTINGS comes to mind. - Today
-
I have moved your thread to the AutoCAD Bugs, Error Messages & Quirks Forum. Can you post a screenshot of what's happening?
-
That works well if there is only one value that needs to be replaced. Thanks.
-
emmeci joined the community
-
pkenewell started following The pound sign wobbles textreplacer
-
The pound sign wobbles textreplacer
pkenewell replied to bustr's topic in AutoLISP, Visual LISP & DCL
Why not just use the built-in FIND command in AutoCAD? You just have to turn off the "Use Wildcards" option. -
My screen is occupied for a half by a dark grey space, so I can view only a part of the model or of the sheet. How can modify this visualization to have back the fill screen to work?
-
bustr started following The pound sign wobbles textreplacer
-
The text replacer lisp refuses to work when there is a # in the text string tobe replaced or the string to replace it. Does anyone know how to fix? revised per #555188 revised per #666299 TXTREPLACE.LSP
-
gglorja joined the community
-
jim78b started following autocad 3d multi layout problem with transparency
-
autocad 3d multi layout problem with transparency
jim78b posted a topic in AutoCAD 3D Modelling & Rendering
if i publish to pdf multi sheet layout the transparency items appear like in photo, with a lot of lines. why? if i remove silhoutte edges the problem solve, but i want line thickness. -
joeywiii joined the community
-
manjunath joined the community
-
zwcad SHX Text Not Editable in PDF
SLW210 replied to CHAKRADHAR's topic in AutoCAD Drawing Management & Output
The OP seems to have exited the conversation, but just for others with the same inquiry. As I have mentioned, this is mostly an issue with your PDF editor, the instructions for using the OCR should be in Foxit Help. If this is something you need to do going forward without any effort, you need to use TTF. -
Node of Arc Length Dimension
SLW210 replied to dickeychan's topic in AutoCAD 2D Drafting, Object Properties & Interface
I moved your thread to the AutoCAD 2D Drafting, Object Properties & Interface Forum. It is indeed a pain. Your only options AFAIK, use LIMITS instead of EXTENTS or EXPLODE the Dimension. -
Spigi116 joined the community
-
Help with Penn Foster structural drafting plate 1
ReMark replied to JimJames1978's topic in Student Project Questions
The student should have already drawn the channels, in sectional view, prior to sheet 4. All you are being asked to do is provide an enlarged view since you are creating a detail sheet. Refer to American Standard Steel Channels: Weight, Dimensions, & Properties. Copy the sectional view of one of your channels (previously drawn prior to Sheet 4), paste it in your new sheet, then use the Scale command to enlarge the geometry by the necessary scale factor called for in your instructions. -
dickeychan joined the community
-
Node of Arc Length Dimension
dickeychan posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
is there any opinion to "hide" the center node...? sometime I use DimArc at Pspace, the center node shown outside the title block... (or DimArc at Mspace, the center node shown at the outer space...) it affects Zoom~Extents and choosing Extents as plot area... (gotta use Window to point-pick plot area... it's pretty trouble as I use Page Setup to Publish outputs very often...) -
Emil.larsson1 joined the community
-
Flo joined the community
-
Blank DWG with a large file size...
Flo replied to lamensterms's topic in AutoCAD Drawing Management & Output
Look with Civil3D in Toolspace ; Settings ; Pipe Network ; Delete part lists like Full Part List if they exist. -
stankits joined the community
- Yesterday
-
tombu started following SHX Text Not Editable in PDF
-
zwcad SHX Text Not Editable in PDF
tombu replied to CHAKRADHAR's topic in AutoCAD Drawing Management & Output
As most of us use Microsoft Office products I switched from using AutoCAD's Swiss Lt BT TrueType font to ArialNarrow.ttf like SLW210 suggested as it's horizontally compressed to take up less space while being even more easily readable. While hindsight doesn't fix your immediate problem finding a font that doesn't cause issues with your PDF software before you need to output one to PDF again would solve your issues in the future. I've struggled with the same issue even with the full paid version of Adobe with drawings by others usually because of SHX text with various width factors. Never do that with a DWG you want to output to PDF unless you don't want anyone to convert that text back again. -
Can you post a sample dwg, tested on dummy dwg's.
-
Help with Penn Foster structural drafting plate 1
TimC replied to JimJames1978's topic in Student Project Questions
Alright, I've been searching and searching on here and I feel like an idiot but maybe it's all the OT I've been working and I'm tired but I'm TOTALLY lost on sheets 4 and 5. I was hoping to be done with this structural project today or tomorrow so I could get to working on the civil since I have a promotion waiting for me at work when it's done and this whole project is driving me nuts. I'm not even gonna use any of this whole degree. I just have to appease "pencil pushers" so here I am. Ok, rant over....lol...more specifically, where do I find the dimensions for this stuff? -
I've just tried the above code with the necessary changes but cannot get it to work for some reason. Running the code as written produces no change in any attributes. I've changed the file path to be correct, as well as replacing "MATERIAL" with a tag name that is actually used in my blocks. It also seems that this portion: (foreach att atts (setq tname (vlax-get att 'Tagstring)) (if (= tname "MATERIAL") (vlax-put att 'Textstring "TEST") ) changes all tags of a certain type to a new value. I would like to change the value of the tag named "RATING1" for all components with value "CT-1" in tag named "COMPID", and do this across all drawings. All of that to say, I'm new to this and probably just using it incorrectly, but after doing all the learning that I can for now, I'm not sure what I'm doing wrong, or if the code's intention matches my goal.
- Last week
-
Attention fellow Penn Foster structural drafting students....
ReMark replied to TimC's topic in Student Project Questions
I am not aware of any major changes. They may have revised the project instructions re: errors, misspellings, etc. -
Vehicle Tracking - where to find details for vehicles
Steven P replied to Adam - Inspire's topic in Autodesk Software General
I might just do that!! -
Vehicle Tracking - where to find details for vehicles
BIGAL replied to Adam - Inspire's topic in Autodesk Software General
Have a go at adding this vehicle, they are daunting when you meet them on the road. Let alone the 3 x 19m petrol tankers. Recording 2026-03-01 183700.mp4 -
Attention fellow Penn Foster structural drafting students....
TimC replied to TimC's topic in Student Project Questions
yep I've been on here all morning. I know there was some mention of some slight changes to the plans over the years. Do you know if any major changes were made from 2018 to now? I'm seeing some conflicting versions and I wasn't sure if there were changes or if some drawings weren't finished yet -
Attention fellow Penn Foster structural drafting students....
ReMark replied to TimC's topic in Student Project Questions
If you finished the residential house project, then you shouldn't have any problems with the structural project. Plan view, elevation view, sectional view and details is pretty much a standard whether it is a house that is being designed or a commercial building (ex. - warehouse, office building, etc.).
