Script to close some specific files

Discussion in 'AutoCAD' started by A-DESIGN, Aug 25, 2004.

  1. A-DESIGN

    A-DESIGN Guest

    Hi,
    How can I write a script to close some specific files without closing all
    files ?
    Thanks
     
    A-DESIGN, Aug 25, 2004
    #1
  2. How can I write a script to close some specific files without closing all
    files ?

    It looks like people don't do this too much. Instead, they use scripts on
    each file by itself, one file after another. Also search for "script MDI"
    and "script SDI".
    Some of the links in these searches should help. They're in the
    customization NG instead of the VBA one.

    http://groups.google.com/groups?q=script+close+single+file+group:autodesk.autocad.customization.*

    http://groups.google.com/groups?q=script+group:autodesk.autocad.customization.*


    James
     
    James Belshan, Aug 26, 2004
    #2
  3. Strike three an it's some trial and error time...:) Then post what won't
    work...
     
    Paul Richardson, Aug 26, 2004
    #3
  4. didn't mean that to sound so abrupt...

    If you can do it at the command line, than you can
    do it in a script file. Work out how you would do
    in AutoCAD first then just reproduce line for line..
    With some headaches along the way...gl
     
    Paul Richardson, Aug 26, 2004
    #4
  5. A-DESIGN

    A-DESIGN Guest

    Thanks Paul,I am still working on it,another thing I couldn't figure out is
    using filter or quick select on scripts, I need to select all Hatches in
    order to change their color to yellow , do you know how I can do this?
    Thanks,
     
    A-DESIGN, Aug 26, 2004
    #5
  6. going on the assumption that they are all isolated on the same layer named
    "hat" or such..I would change the color of this layer..

    Otherwise you could call a lisp from your scr. that makes the selection set.
     
    Paul Richardson, Aug 26, 2004
    #6
  7. A-DESIGN

    A-DESIGN Guest

    Very nice,Thanks,
    Let me ask another one please is it possible to change case of the layer's
    name ? lower case to upper case ?Thanks,
     
    A-DESIGN, Aug 26, 2004
    #7
  8. (ssget "X" (list(cons 0 "Hatch")))
    Erase P | or rip it up however ya want..

    you could place this right in the scr...don't forget spaces after P none
    after first line
    Yes the same why you would rename something at the command line...:)
     
    Paul Richardson, Aug 26, 2004
    #8
  9. -RENAME la test Test |

     
    Paul Richardson, Aug 26, 2004
    #9
  10. A-DESIGN

    A-Design Guest

    Thanks for reply ,what I need is converting almost 50-60 layers name from
    lowercase to uppercase every time I need, I don't want to rename them one by
    one. Is there any way to do that by the scripts?Thanks,

    Afshin
     
    A-Design, Aug 26, 2004
    #10
  11. Hi,

    You can answer your own question very easily. Try to do it from the
    keyboard. If you can, then you can do it with a script. If you can't then
    you can't.
    A script is nothing more than a set of keystrokes passed to the command
    line.

    You can certainly do it with Lisp or VBA.

    In VBA.

    sub LayerCase ()
    dim x as acadlayer
    for each x in thisdrawing.layers
    x.name = ucase(x.name)
    next
    end sub

    --

    Regards


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Aug 26, 2004
    #11
  12. Call this lisp from you script...Copied and edited from Afralisp.com

    (defun c:ChLayCase ( / acadDocument theLayers layName)
    (vl-load-com)

    (setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
    (setq theLayers (vla-get-layers acadDocument))
    (vlax-map-collection theLayers 'layer-mod)
    (princ)
    );defun

    (defun layer-mod (theLayer)
    (setq layName (vlax-get-property theLayer 'Name))
    (if (not (member layName '("0" "Defpoints")))
    (vla-put-Name thelayer (strcase layName))
    ) ;if
    );defun
    (princ)
     
    Paul Richardson, Aug 26, 2004
    #12
  13. VBA is cleaner..:) you could also call Laurie's VBA..
     
    Paul Richardson, Aug 26, 2004
    #13
  14. A-DESIGN

    A-DESIGN Guest

    Thank you very much for your helps.


     
    A-DESIGN, Aug 26, 2004
    #14
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.