DIESEL for drawing number

Discussion in 'AutoCAD' started by lister@rfa, May 31, 2004.

  1. lister@rfa

    lister@rfa Guest

    I use diesel for a plot stamp so have limited knowledge of how it works. We have several jobs where drawings numbers will change periodically as new information is added.

    I would like to use a diesel expression in my title block which will grab a portion of the filename to use as the drawing number. An example from my current project is:

    file name: EC-330-E-001 (ELECTRICAL ROOM LAYOUT).dwg

    I would like everything before the <space>( to be inserted as the drawing number. I'm pretty sure this can be done by limiting the string length that DIESEL picks up, but was wondering if it could be variable so that it would also pick up the proper string from a file name such as:

    E1 (ELECTRICAL ROOM LAYOUT).dwg

    I am currently using R2004
     
    lister@rfa, May 31, 2004
    #1
  2. lister@rfa

    ECCAD Guest

    Diesel or Rtext with Diesel expresion won't get it. You can
    use Lisp to get the drawing number.
    Try:
    Save the following as 'get_drawing_number.lsp'..save to
    support folder..

    (defun get_drawing_number ( dwgname c flag ctr d)
    (setq dwgname (getvar "DWGNAME"))
    (setq c (strlen dwgname))
    (setq flag 0 ctr 1 drawing_name "")
    (repeat c
    (setq d (substr dwgname ctr 1))
    (if (or (= d ".")(= d " "))
    (setq flag 1)
    ); end if
    (if (= flag 0)
    (setq drawing_name (strcat drawing_name d)); stack characters
    ); end if
    (setq ctr (+ ctr 1))
    ); end repeat
    drawing_name
    ); end function
    ;; use variable drawing_name for your drawing number.
    ..................
    In acaddoc.lsp, add:
    (load "get_drawing_number.lsp")
    .. (you will have to 'replace' your drawing number value
    with entmod function, in order to make it 'automatic'.

    Bob
     
    ECCAD, Jun 1, 2004
    #2
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.