Lisp to change 2004 Wblock to R2000. Please help

Discussion in 'AutoCAD' started by MikeNowson, Jan 26, 2004.

  1. MikeNowson

    MikeNowson Guest

    Hello,
    I am trying to wblock out part of a drawing and have a routine which
    automatically resaves the file as V2000. Surely this can not be hard
    but as I have limited lisp skills I am stuck. Any help would be great.

    (if (findfile dwgnm)
    (command "wblock" dwgnm "y" "" '(0 0 0) ss "" "oops")
    (command "wblock" dwgnm "" '(0 0 0) ss "" "oops")
    (command "filedia" "0")
    (if (findfile dwgnm)
    (progn (command "qsave")(command "open" dwgnm))
    )

    (COMMAND "saveas" "2000" dwgnm "y")
    (command "filedia" "1")
    )

    This obiously does not work as the drawing will not open as I can not
    work out the syntax...



    Thanks
    Mike Nowson

    PS I would rather not have to close the current drawing that I am
    wblocking from is that possible. Ie to open another file without
    closing the active file?
     
    MikeNowson, Jan 26, 2004
    #1
  2. Take a look at this VBA sample that might give you what you need:
    http://www.jtbworld.com/VBA/WblockTo2000.htm

    --
    Best Regards, Jimmy Bergmark
    CAD and Database Developer Manager at www.pharmadule-emtunga.com
    Take a look at
    JTB FlexReport (FLEXlm report tool) - www.jtbworld.com/jtbflexreport
    SmartPurger (Purges automatically) - www.jtbworld.com/?/smartpurger.htm
    or download some freeware at www.jtbworld.com
    More on AutoCAD 2004;
    www.jtbworld.com/autocad2004.htm
    www.jtbworld.com/autocad2004tips.htm
     
    Jimmy Bergmark, Jan 26, 2004
    #2
  3. MikeNowson

    zeha Guest

    have you try the command SDI
    this is single drawing interface is set to 1
    then the command open is available
     
    zeha, Jan 26, 2004
    #3
  4. MikeNowson

    ECCAD Guest

    Try this one:

    (setvar "SDI" 0)
    ;;
    (if (findfile dwgnm)
    (command "wblock" dwgnm "y" "" '(0 0 0) ss "" "oops")
    (command "wblock" dwgnm "" '(0 0 0) ss "" "oops")
    );eif
    (command "filedia" "0")
    (if (findfile dwgnm)
    (progn
    (command "_qsave")
    (command ".open" dwgnm)
    (command ".saveas" "2000" dwgnm "y")
    );epr
    );eif
    ;;
    (command "filedia" "1")

    Bob
     
    ECCAD, Jan 26, 2004
    #4
  5. MikeNowson

    rdi Guest

    two issues here

    1 - if the user didn't specify DWG (which most users won't do) as part of dwgnm, then findfile WON'T find the file--even if it DOES exist.
    2 - it could be simplified by putting the if statement inside the command call

    Try changing from:

    (if (findfile dwgnm)
    (command "wblock" dwgnm "y" "" '(0 0 0) ss "" "oops")
    (command "wblock" dwgnm "" '(0 0 0) ss "" "oops")
    );eif

    To this:

    ;if the user did NOT specify dwg as part of dwgnm then add it
    (if (wcmatch (strcase dwgnm) (strcase "*.dwg"))(setq dwgnm (strcat dwgnm "*.dwg"))

    ;if dwgnm is found then you need to pass a "Yes" to over-write the file other wise just tell acad to continue.
    (command "wblock" dwgnm (if (findfile dwgnm) "y" "") "" '(0 0 0) ss "" "oops")
     
    rdi, Jan 26, 2004
    #5
  6. MikeNowson

    MikeNowson Guest

    Hello,
    I am still having trouble with the open command...I am in Multiple drawing mode I try:

    (command (open dwgnm "w"))

    or When I try the actual file path:

    (command (open "Z:/exchange/!miken.dwg" "w"))

    The open command is processed but the path fails as unrecognised which is strange as Saveas executes with no problem:
    ;;(command "SaveAs" "2000" dwgnm "y")

    I am confused and can not work out this command...any helpwould be great

    Regards
    Mike Nowson
     
    MikeNowson, Jan 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.