Automatic Wblock Naming

Discussion in 'AutoCAD' started by Steve Wojtynek, Jul 27, 2004.

  1. I've already created a bunch of drawings that contain (3) separate 2D views
    of a 3D furniture block. (top, front, and side views to be used in a
    separate 2D Furniture Blocks menu). Now I'd like to run a script (in
    ScriptPro) that opens those drawings and then extracts 3 separate WBLOCKs
    with "automatic names" that add a letter to the beginning of the "current"
    filename. Is there a way to do that with a lisp expression in the simple
    scripting?

    Here's what I've tried so far.

    CMDDIA

    0

    FILEDIA

    0

    -WBLOCK

    (R_(GETVAR "DWGNAME")) (THIS DOESN'T WORK. Can I add something to the
    current "DWGNAME" as my new filename?)

    -22,2

    70,82

    OOPS

    -WBLOCK

    (T_(GETVAR "DWGNAME"))

    0,0

    -22,98

    70,190

    OOPS

    -WBLOCK

    (F_(GETVAR "DWGNAME"))

    0,0

    74,2

    166,94

    OOPS

    FILEDIA

    1

    CMDDIA

    1

    QSAVE

    QUIT

    YES
     
    Steve Wojtynek, Jul 27, 2004
    #1
  2. Steve Wojtynek

    Jim Claypool Guest

    (strcat "R_" (GETVAR "DWGNAME"))
     
    Jim Claypool, Jul 27, 2004
    #2
  3. Steve Wojtynek

    ECCAD Guest

    Change:
    (R_(G ETVAR "DWGNAME"))
    To:
    (strcat "R_" (substr (GETVAR "DWGNAME") 1 (- (strlen (getvar "dwgname" 4)))))

    Bob
     
    ECCAD, Jul 27, 2004
    #3
  4. Perfect! Thanks!

     
    Steve Wojtynek, Jul 27, 2004
    #4
  5. Steve Wojtynek

    ECCAD Guest

    Correction:
    (strcat "R_" (substr (GETVAR "DWGNAME") 1 (- (strlen (getvar "dwgname") 4))))

    Bob
     
    ECCAD, Jul 27, 2004
    #5
  6. Steve Wojtynek

    Jim Claypool Guest

    You don't need to strip the .dwg from the drawing name before passing it to
    wblock.
     
    Jim Claypool, Jul 27, 2004
    #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.