+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
  1. #1
    Senior Member NoelStalker's Avatar
    Computer Details
    NoelStalker's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T5400
    Motherboard:
    Dell 0RW203
    CPU:
    Intel(R) Xeon(R) E5405 @ 2.00GHz 2.00 GHz (2 processors)
    RAM:
    32GB
    Graphics:
    NVIDIA Quadro K5000
    Primary Storage:
    200GB SSD
    Secondary Storage:
    1TB
    Discipline
    Mechanical
    NoelStalker's Discipline Details
    Occupation
    CAD Designer
    Discipline
    Mechanical
    Using
    Mechanical 2015
    Join Date
    Oct 2008
    Location
    Auburn Hills, MI
    Posts
    128

    Question FIND command without dialog box?

    Registered forum members do not see this ad.

    Is it possible to access the find command from the command line and input your search text in the command line instead of in the dialog box?

    I tried -find _find and .find and those didn't work.

    I want to manipulate the find and replace command with a lisp and I don't know how to do that with dialog boxes.

  2. #2
    Super Moderator fuccaro's Avatar
    Discipline
    Mechanical
    fuccaro's Discipline Details
    Occupation
    Mechanical eng.
    Discipline
    Mechanical
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,577

    Default

    As a walkaround you could explore the WCMATCH lisp function.
    In the Help file it says nothing about a command line version (as it says for other commands), so probable you are out of luck this time.
    It's nice to be nice, but sometimes is nicer to be evil!
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  3. #3
    Senior Member NoelStalker's Avatar
    Computer Details
    NoelStalker's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T5400
    Motherboard:
    Dell 0RW203
    CPU:
    Intel(R) Xeon(R) E5405 @ 2.00GHz 2.00 GHz (2 processors)
    RAM:
    32GB
    Graphics:
    NVIDIA Quadro K5000
    Primary Storage:
    200GB SSD
    Secondary Storage:
    1TB
    Discipline
    Mechanical
    NoelStalker's Discipline Details
    Occupation
    CAD Designer
    Discipline
    Mechanical
    Using
    Mechanical 2015
    Join Date
    Oct 2008
    Location
    Auburn Hills, MI
    Posts
    128

    Question Wcmatch

    fuccaro,
    What is the wcmatch lisp? It apparently isn't bundled with my version of ACAD (2005) because I typed it and nothing happened.

  4. #4
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell
    CPU:
    Intel Xeon E5-1603@2,80GHz
    RAM:
    4GB
    Graphics:
    NVIDA Quadro K600
    Monitor:
    DELL 23" & SAMSUNG 21"
    Using
    not applicable
    Join Date
    Nov 2005
    Location
    Kenley, Surrey, UK
    Posts
    5,644

    Default

    I haven't found a way yet. I have written a VBA routine to do similar things but don't have it at home.
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson
    "Everything in drafting is logical. Except what isn’t." - Gavin Guile. (from the Lightbringer series of books by Brent Weeks)

    Dave

  5. #5
    Super Moderator fuccaro's Avatar
    Discipline
    Mechanical
    fuccaro's Discipline Details
    Occupation
    Mechanical eng.
    Discipline
    Mechanical
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,577

    Default

    Quote Originally Posted by NoelStalker View Post
    fuccaro,
    What is the wcmatch lisp? It apparently isn't bundled with my version of ACAD (2005) because I typed it and nothing happened.
    Quote Originally Posted by AutoLisp help file
    (wcmatch string pattern)
    Arguments
    string
    A string to be compared. The comparison is case-sensitive, so uppercase and lowercase characters must match.
    pattern
    A string containing the pattern to match against string. The pattern can contain the wild-card pattern-matching characters shown in the table Wild-card characters. You can use commas in a pattern to enter more than one pattern condition. Only the first 500 characters (approximately) of the string and pattern are compared; anything beyond that is ignored.
    Both arguments can be either a quoted string or a string variable. It is valid to use variables and values returned from AutoLISP functions for string and pattern values.
    Return Values
    If string and pattern match, wcmatch returns T; otherwise, wcmatch returns nil.
    it must be in 2005 too!
    It's nice to be nice, but sometimes is nicer to be evil!
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  6. #6
    Senior Member NoelStalker's Avatar
    Computer Details
    NoelStalker's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T5400
    Motherboard:
    Dell 0RW203
    CPU:
    Intel(R) Xeon(R) E5405 @ 2.00GHz 2.00 GHz (2 processors)
    RAM:
    32GB
    Graphics:
    NVIDIA Quadro K5000
    Primary Storage:
    200GB SSD
    Secondary Storage:
    1TB
    Discipline
    Mechanical
    NoelStalker's Discipline Details
    Occupation
    CAD Designer
    Discipline
    Mechanical
    Using
    Mechanical 2015
    Join Date
    Oct 2008
    Location
    Auburn Hills, MI
    Posts
    128

    Default

    fuccaro,
    Thanks! I understand how this could help me find matching strings. How would I be able to replace what I found with a new string?

  7. #7
    Super Moderator fuccaro's Avatar
    Discipline
    Mechanical
    fuccaro's Discipline Details
    Occupation
    Mechanical eng.
    Discipline
    Mechanical
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,577

    Default

    Use the SUBSTR to cut the string in pieces and STRCAT to join them back. Ofcourse you will replace the unwanted pieces with your own strings.
    It's nice to be nice, but sometimes is nicer to be evil!
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  8. #8
    Senior Member cadvision's Avatar
    Computer Details
    cadvision's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL inspiron
    CPU:
    i7-3632QM CPU @2.2GHz
    RAM:
    8GB
    Primary Storage:
    1TB
    Monitor:
    aoc 24"
    Discipline
    Multi-disciplinary
    cadvision's Discipline Details
    Occupation
    Software distributor, contract drafting/scanning
    Discipline
    Multi-disciplinary
    Details
    Electro/Mechanical Drafty since Drawing Board. Mainly work in Petrochemical and Dairy Industries. Specialise in Maintenace, Process and I&E Drafting since 1980.
    Using
    AutoCAD 2016
    Join Date
    Sep 2008
    Location
    New Zealand
    Posts
    202

    Default

    This is an old release 12 find/replace lisp:


    ;;; REPTEXT.LSP 3.xx is a substantially rewritten version compared to
    ;;; version 2.xx. Please see the * HISTORY * section below.
    ;;; REPTEXT.LSP is an AutoCAD Release 12 utility to search & replace
    ;;; text items in a drawing, including within block definitions,
    ;;; dimensions, and attributes. It will also process these entities in
    ;;; nested blocks to any depth.
    ;;; This routine can be used to search for all or selected instances of
    ;;; a particular text string, and replace them with a different string.
    ;;; This is most useful for global replacement of references, phrases,
    ;;; and control codes. As an example, this routine could be used to
    ;;; replace the old Release 10-style %%127, 128 and 129 control codes,
    ;;; with the later %%d, %%p and %%c codes respectively.
    ;;; * USAGE *
    ;;; After loading the routine (eg. (load "reptext")) and executing by
    ;;; typing REPTEXT at the Command: prompt, there are only five or six
    ;;; prompts to respond to. First you will be asked to specify the text
    ;;; string to search for, and the string to replace it with. Both can
    ;;; contain spaces. The search string is not case sensitive.
    ;;; You are then asked what entity types you wish to process. These can
    ;;; be normal text, dimension user-supplied text, blocks (containing any of
    ;;; the other entity types, including nested blocks), and block attribute
    ;;; values. If you respond with Y or Yes to any of these, any relevant
    ;;; selected entities will be processed. Responding Y or Yes to blocks
    ;;; will also ask if attribute values are to be processed. A negative
    ;;; answer to all entity types will repeat the prompt sequence.
    ;;; Lastly, you are asked to select the entities to modify. You can do
    ;;; this with any of the normal AutoCAD entity selection methods (including
    ;;; ALL, to process the entire drawing). REPTEXT will filter out the
    ;;; required entities.
    ;;; The routine will then start processing - you will see text entities
    ;;; being dynamically altered on screen. Block definitions will be
    ;;; regenerated on screen after processing is complete. Have fun!
    ;;; Peter J T Heald, Autodesk UK Ltd.
    ;;; Tech are the biz.
    ;;; * HISTORY *
    ;;; The main changes between version 2.xx and this version are as follows:
    ;;; Associative dimensions will not loose their updated text values
    ;;; during stretching and moving.
    ;;; Block attribute values will now be processed.
    ;;; Dimensions, text, blocks & attributes within blocks will now be
    ;;; processed no matter what the level of nesting.
    ;;; The main reason for rewriting was because version 2.xx was pretty naf.
    ;;; Notation will be added to the code at some stage, when I have time...
    ;;; Any comments or suggestions relating to this routine are most welcome.
    ;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
    ;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
    ;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
    (prompt " REPTEXT.LSP by P.Heald Sept'92-Apr'93 Ver. 3.01\n")
    ;;; Global variables are: blist oldtxt newtxt txttoo dimtoo blktoo atttoo
    (defun c:reptext ( / sslist ss count en bllen bdata nen)
    (setvar "cmdecho" 0)
    (setq oldtxt (getstring T "\nText to search for: ")
    newtxt (getstring T "\nReplace with: ")
    txttoo F
    dimtoo F
    blktoo F
    )
    (while (not (or txttoo dimtoo blktoo))
    (prompt "\nSelect desired operation.")
    (initget "Yes No")
    (setq txttoo (getkword "\nProcess normal text? <Y> : ")
    sslist '((-4 . "<OR"))
    )
    (if (= txttoo "No")
    (setq txttoo F)
    (setq sslist (append sslist '((0 . "TEXT")))
    txttoo T
    )
    )
    (initget "Yes No")
    (setq dimtoo (getkword "\nProcess dimensions? <N> : "))
    (if (= dimtoo "Yes")
    (setq sslist (append sslist '((0 . "DIMENSION"))))
    (setq dimtoo F)
    )
    (initget "Yes No")
    (setq blktoo (getkword "\nProcess blocks? <N> : "))
    (if (= blktoo "Yes")
    (progn (initget "Yes No")
    (setq sslist (append sslist '((0 . "INSERT")))
    atttoo (getkword "\nProcess attributes? <N> : ")
    )
    )
    (setq blktoo F)
    )
    (if (/= atttoo "Yes") (setq atttoo F))
    )
    (setq sslist (append sslist '((-4 . "OR>")))
    ss (ssget sslist)
    count 0
    blist (list)
    )
    (prompt "\nProcessing:-\n")
    (repeat (sslength ss)
    (setq en (ssname ss count)
    count (1+ count)
    )
    (entscan en oldtxt newtxt)
    (prompt (strcat "\r" (itoa count) " done."))
    )
    (prompt "\rDone ")
    (setq count 0
    bllen (length blist)
    )
    (if (> bllen 0) (prompt "\nProcessing blocks:-\n"))
    (while (and (> bllen 0) (setq bname (nth count blist)))
    (setq count (1+ count)
    bdata (tblsearch "BLOCK" bname)
    nen (cdr (assoc -2 bdata))
    )
    (while (and nen
    (/= (cdr (assoc 0 (entget nen))) "ENDBLK")
    )
    (entscan nen oldtxt newtxt)
    (setq nen (entnext nen))
    )
    (prompt (strcat "\r" (itoa count) " done."))
    )
    (prompt "\rDone ")
    (if (or dimtoo blktoo)
    (progn (prompt "\nRegenerating drawing.")
    (command ".regen")
    )
    )
    (princ)
    )
    (defun entscan (en oldtxt newtxt / ed et 2f tmp)
    (setq ed (entget en)
    et (cdr (assoc 0 ed))
    2f (cdr (assoc 2 ed))
    )
    (cond ((and (= et "TEXT") txttoo) (swaptext en oldtxt newtxt))
    ((and (= et "DIMENSION") dimtoo)
    (progn (swaptext en oldtxt newtxt)
    (if (setq tmp (chklist blist 2f))
    (setq blist tmp)
    )
    )
    )
    ((and (= et "INSERT") blktoo)
    (progn (if (setq tmp (chklist blist 2f))
    (setq blist tmp)
    )
    (if (and atttoo (cdr (assoc 66 ed)))
    (attscan en oldtxt newtxt)
    )
    )
    )
    )
    )
    (defun attscan (ename otxt ntxt / edata parent etype)
    (setq edata (entget ename)
    parent edata
    etype "INSERT"
    )
    (while (and ename (/= etype "SEQEND"))
    (setq ename (entnext ename))
    (if ename (setq edata (entget ename)
    etype (cdr (assoc 0 edata))
    )
    )
    (if (= etype "ATTRIB") (swaptext ename otxt ntxt))
    )
    (entmod parent)
    )

    (defun swaptext (ename otxt ntxt / edata oldt newt edata)
    (setq edata (entget ename)
    oldt (assoc 1 edata)
    )
    (if oldt
    (progn (setq newt (cons 1 (swapstr (cdr oldt) otxt ntxt))
    edata (subst newt oldt edata)
    )
    (entmod edata)
    )
    )
    )
    (defun swapstr (line oldstr newstr / charpos oldlen)
    (setq oldlen (strlen oldstr)
    oldstr (strcase oldstr)
    charpos 1
    )
    (repeat (1+ (- (strlen line) oldlen))
    (if (= (strcase (substr line charpos oldlen)) oldstr)
    (setq line (strcat (substr line 1 (1- charpos))
    newstr
    (substr line (+ charpos oldlen))
    )
    charpos (+ charpos (strlen newstr))
    )
    )
    (setq charpos (1+ charpos))
    )
    (setq line line)
    )
    (defun chklist (itemlist itemname)
    (if (member itemname itemlist)
    (setq itemlist F)
    (setq itemlist (append itemlist (list itemname)))
    )
    )
    (princ)
    ; - - - - - - - - - - - - - - - - - - - End

  9. #9
    Senior Member NoelStalker's Avatar
    Computer Details
    NoelStalker's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T5400
    Motherboard:
    Dell 0RW203
    CPU:
    Intel(R) Xeon(R) E5405 @ 2.00GHz 2.00 GHz (2 processors)
    RAM:
    32GB
    Graphics:
    NVIDIA Quadro K5000
    Primary Storage:
    200GB SSD
    Secondary Storage:
    1TB
    Discipline
    Mechanical
    NoelStalker's Discipline Details
    Occupation
    CAD Designer
    Discipline
    Mechanical
    Using
    Mechanical 2015
    Join Date
    Oct 2008
    Location
    Auburn Hills, MI
    Posts
    128

    Default

    cadvision
    This is a great routine. Unfortunately, it doesn't work for me because it doesn't edit mtext, apparently.

  10. #10
    Senior Member cadvision's Avatar
    Computer Details
    cadvision's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL inspiron
    CPU:
    i7-3632QM CPU @2.2GHz
    RAM:
    8GB
    Primary Storage:
    1TB
    Monitor:
    aoc 24"
    Discipline
    Multi-disciplinary
    cadvision's Discipline Details
    Occupation
    Software distributor, contract drafting/scanning
    Discipline
    Multi-disciplinary
    Details
    Electro/Mechanical Drafty since Drawing Board. Mainly work in Petrochemical and Dairy Industries. Specialise in Maintenace, Process and I&E Drafting since 1980.
    Using
    AutoCAD 2016
    Join Date
    Sep 2008
    Location
    New Zealand
    Posts
    202

    Default

    Registered forum members do not see this ad.

    I have a solution for your MTEXT. Explode! I'm not a huge fan of MTEXT. I get pissed off when I find single lines of text in drawings done with MTEXT.

Similar Threads

  1. Find and replace text without a dialog box
    By y49sides in forum AutoLISP, Visual LISP & DCL
    Replies: 18
    Last Post: 9th Jan 2012, 03:34 pm
  2. Find/Replace text without a dialog box?
    By y49sides in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 11th Jul 2009, 11:43 pm
  3. find command finds but shows nothing
    By NoelStalker in forum AutoCAD General
    Replies: 2
    Last Post: 29th Oct 2008, 05:22 pm
  4. Cannot find Command???
    By MikeP in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 18th Jul 2008, 05:24 pm
  5. command exist or not!! how to find?
    By musa in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 29th Aug 2006, 06:03 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts