tblsearch question..

Discussion in 'AutoCAD' started by C Witt, Jul 25, 2003.

  1. C Witt

    C Witt Guest

    Using this function:
    (tblsearch "dimstyle" "stylename")

    Is there a way that it can search for "part" of a style name?.. ie:

    (tblsearch "dimstyle" "sty") and if "stylename" exists, it will find it.

    The reason is we have many stylenames with the same "start" but i want
    one search command to be able to return a "match" if it minds any of
    them.. rather than 30+ searches..
     
    C Witt, Jul 25, 2003
    #1
  2. do you need a list of names? or a list of data?

    ; performs a wildcard match between the second
    ; element in dxf code 2 and [entry] for each
    ; entry defined in [table].
    ; [table] - string, table name
    ; [entry] - string, entry name
    ; return - list, list of entity lists
    ; example: (wcTable "dimstyle" "stan*")
    (defun wcTblnext (table entry / data rtn)
    (setq table (strcase table))
    (setq entry (strcase entry))
    (while (setq data (tblnext table (null data)))
    (if (wcmatch (strcase (cdr (assoc 2 data))) entry)
    (setq rtn (cons data rtn))) )
    (reverse rtn)
    )

    for a list of data
    (setq data (wcTblnext "style" "st*"))


    for a list of names
    (mapcar '(lambda (x) (cdr (assoc 2 x))) data)
     
    Jason Piercey, Jul 25, 2003
    #2
  3. oops.... need to revise that example...
     
    Jason Piercey, Jul 25, 2003
    #3
  4. So we are back to the (if <then> <else>) expression.

    (if (wcTablenext "dimstyle" "sty*")
    ; do your lisp
    ;else
    ; don't do anything.
    )
     
    Jason Piercey, Jul 25, 2003
    #4
  5. C Witt

    C Witt Guest

    right..

    ok I tried that search command.. and got a syntax error..(whatever that is)
     
    C Witt, Jul 25, 2003
    #5
  6. Could be the fact that I can't make up my mind on what the
    function name should be <g>.

    (if (wcTBLnext "dimstyle" "sty*")
    ; do your lisp
    ;else
    ; don't do anything.
    )

    also, post what you tried.
     
    Jason Piercey, Jul 25, 2003
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.