Run Once on Drawing @ open?

Discussion in 'AutoCAD' started by MiD-AwE, Feb 17, 2005.

  1. MiD-AwE

    MiD-AwE Guest

    Hi all

    I need to force the user to "saveas" immediately after starting a new drawing. I'm using ACAD.DWT for all new drawings but if the user doesn't "saveas" after the template opens then they end up with drawings getting saved as "drawing1.dwg", "drawing2.dwg", etc. on their local drive. This causes several issues due to our company policy of jobs required to be saved on network drive. I want to force the user to immediately save the drawing on the network with user specified name each time the template is opened, or allow the user to consciously cancel save.

    Does anyone have any suggestions. Each of our drawings are supposed to be saved as a specific job number "J<some number>" can this be used as a tool to check if the drawing has been previously saved so that the user is not prompted each time any drawing is opened, like checking for left$ "J"?

    Or, is this simply a reactor and VBA solution?

    Thanks for your help.
     
    MiD-AwE, Feb 17, 2005
    #1
  2. MiD-AwE

    BillZ Guest

    I agree with Dean.

    When you start a new drawing in AutoCAD (an unnamed drawing) and you hit the save button, the SaveAs dialog automatically comes up. Then it's up to the user to select the correct directory and give a correct name.

    This process, I believe will default to the last directory used for any subsequent drawings saved.



    Bill.
     
    BillZ, Feb 17, 2005
    #2
  3. MiD-AwE

    jlspartz Guest

    You could check the name of the drawing and then give it a command to do if it is equal to that name, like so:

    (setq dwgsaveas(getvar "dwgname"))
    (cond
    ((= dwgsaveas "Drawing1.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing2.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing3.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing4.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing5.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing6.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing7.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing8.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing9.dwg")(command "saveas" "" "~"))
    ((= dwgsaveas "Drawing10.dwg")(command "saveas" "" "~"))
    (t nil)
    )

    I tried using a wildcard like "Drawing*.dwg", but I didn't get it to work. Maybe someone else can get a wildcard in there. But, this will go from 1-10.

    You would just put the code at the end of your acaddoc.lsp file to run it each time a drawing opens.
     
    jlspartz, Feb 17, 2005
    #3
  4. MiD-AwE

    Tom Smith Guest

    This is a training issue.We have never, ever, had any issue of any kind with
    this. Our users are able to ascertain, on their own, whether they have saved
    a drawing with a valid name in a valid location. After all, that is part of
    their job. I've worked with several hundred Acad users, and all of them
    seemed to "get" this with no help or pressure.

    We use a variety of templates of our own design -- none of them ACAD.DWT --
    to produce drawings of different types. The basic procedure to start a new
    drawing is to pick the appropriate template, and once created, save the file
    to the appropriate location. Failing to do this would be a little bit like
    failing to turn the computer on and wondering why the screen looks so dark.

    If you're going to "force" users to perform such an elementary no-brainer of
    a procedure, I can't imagine what you're NOT going to have to "force" them
    to do. If they actually can't remember this, and you're unable to hire a
    replacement staff, why not write up a little checklist, and make them check
    off every item as they go.

    1) Sit in chair facing computer
    2) Grasp mouse
    3) etc.
     
    Tom Smith, Feb 17, 2005
    #4
  5. MiD-AwE

    Tom Smith Guest

    Huh??
     
    Tom Smith, Feb 17, 2005
    #5
  6. MiD-AwE

    jlspartz Guest

    LOL, I agree. You must start training them if they have slipped away from all common thought. I've got 100 cad users and no one has ever had that problem here. I've got a meeting set up in half an hour to train a dozen more advanced users on how to solve other user's common problems.

    I think that's what you need to do is get others involved in teaching, and they will take pride in what they've taught others. As a result, you will get an all around elevated higher learning and knowledge level.
     
    jlspartz, Feb 17, 2005
    #6
  7. MiD-AwE

    Tom Smith Guest

    LOL, I agree. You must start training them if they have slipped away from
    all common thought. I've got 100 cad users and no one has ever had that
    problem here. I've got a meeting set up in half an hour to train a dozen
    more advanced users on how to solve other user's common problems.
    they will take pride in what they've taught others. As a result, you will
    get an all around elevated higher learning and knowledge level.

    I couldn't agree more. When I had about 3 dozen users to support, and was
    faced with a drastic upgrade (from R11 for DOS to R13 for Windows) I was
    forced to delegate, and that turned out to be a great thing.

    I picked about one out of every four or five users and appointed them
    "gurus." I sat with each of them and made them install their own Acad, from
    a checklist I had written. Every question that came up got added to the
    checklist. Then I told them to install it on their neighbor's machines, and
    come to me if they had any problems. I gave them access to a shared Outlook
    mailbox, where we all noted any problems and solutions that arose. Pretty
    soon we had compiled quite a decent knowledge base of R13 related issues.
    People were told to go to their closest "guru" first with any issues, then
    they would come to me if they couldn't solve it.

    Result, they really did become gurus! People were more likely to turn to
    their buddies for help than to walk down the hall to my office. When a
    problem came to me, the obvious solutions had already been tried. It not
    only lightened my work load a lot, but it actually made Acad gurus out of
    the people I'd picked, and the total support task got done better and more
    efficiently. I've done the same thing in every job since.

    In my opinion, the worst possible thing that a "CAD Manager" can do (God I
    hate that title, and I hope I never have it) is to be jealous of his
    knowledge and position. The more the expertise can be shared, the better for
    all concerned.
     
    Tom Smith, Feb 17, 2005
    #7
  8. MiD-AwE

    MiD-AwE Guest

    Thanks, this works great. I've never seen one over Drawing3.dwg so this works fine. I'll still look to discover a possible "wildcard" use, but until then this is exactly for what I was looking.

    Thanks again.
     
    MiD-AwE, Feb 21, 2005
    #8
  9. MiD-AwE

    Tom Smith Guest

    discover a possible "wildcard" use, but until then this is exactly for what
    I was looking.

    The reason I posted "Huh?" is that this makes no sense.

    It tests for 10 different conditions of the drawing name, and does exactly
    the same thing for each one of them. What is the logic in that? How could
    that possibly be what you want? It's pointless. It's not even complete, it
    just trails off at "drawing10" because he got tired of typing.

    Why not eliminate the pointless testing, and just say (command "saveas" ""
    "~") in all cases? That would be exactly the same thing. Or if you think you
    want a wildcard test for the naming pattern, use wcmatch to do it properly.

    But it's not necessary to take either of those approaches, because there is
    a variable dwgtitled which indicates whether the current drawing has been
    named. So the direct solution would be what I posted last week:

    (if (zerop (getvar "dwgtitled"))
    (command "saveas" "" "~"))
     
    Tom Smith, Feb 21, 2005
    #9
  10. MiD-AwE

    Walt Engle Guest

    How about going into the acad.mns file and tilde (`) out save and qsave items. This will gray them out, disallowing the use of them and they will have ONLY the saveas option available.
     
    Walt Engle, Feb 21, 2005
    #10
  11. MiD-AwE

    Tom Smith Guest

    That would only kill the buttons, not disable the commands themselves.

    Defeating qsave would be a pretty terrible thing to do. You could forget
    about training users to save regularly if, for every single save, they had
    to browse to a filename and answer "yes" to overwriting an existing drawing
    file.

    Again, this is entirely a training issue. As I said before:

    The users can't "end up wiith" a wrongly named drawing in the wrong location
    unless they give a silly reponse to a SAVEAS dialog. So forcing the exact
    same SAVEAS dialog upon them earlier in the process isn't very likely to
    improve things, now is it?

    They need to be taught to save a new drawing, once it's created, in the
    correct place with a correct name. Just as in Word or any other program.
    This isn't a new thing, and it isn't specific to Acad. That's how everyone
    everywhere has to work, and in hundreds of Acad users I've never seen any
    who were buffaloed by this process.
     
    Tom Smith, Feb 21, 2005
    #11
  12. MiD-AwE

    Walt Engle Guest

    Merely a suggestion - as I don't want to get into an argument over this silly
    thing. If users can't understand and use basic concepts, then there is a severe
    problem that has to be solved or to be lived with. Can't stop ignorance.
     
    Walt Engle, Feb 21, 2005
    #12
  13. MiD-AwE

    Tom Smith Guest

    If users can't understand and use basic concepts, then there is a severe
    I couldn't agree more.
     
    Tom Smith, Feb 21, 2005
    #13
  14. MiD-AwE

    MiD-AwE Guest

    You code does the same thing. I tried the other solution before your reply and just replied to his solution this morning. Both solutions work for what I needed and I apologize for not replying to you promptly. Thank you for your solution since it is a more efficient method.
     
    MiD-AwE, Feb 21, 2005
    #14
  15. MiD-AwE

    Tom Smith Guest

    You code does the same thing. I tried the other solution before your reply
    and just replied to his solution this morning. Both solutions work for what
    I needed and I apologize for not replying to you promptly. Thank you for
    your solution since it is a more efficient method.

    You're welcome, but there are some differences in the posted code fragments.

    The dwgtitled variable keeps track of whether the drawing has been given a
    name. If you actually saved the new file as drawing1.dwg, then dwgtitled
    would be 1, because it has been saved with a name. The dwgtitled test would
    be sufficient if you only want to force a saveas in a newly created untitled
    drawing.

    In jlspartz's approach, the test is only about the spelling of the drawing
    name. This might be desirable if you want to force a resave on an existing
    file which has already been saved with a "drawing1" type name. You could
    check this with a wild card test:

    (if (wcmatch (getvar "dwgname") "Drawing#*.dwg")
    (command "saveas" "" "~"))

    This will match any name where "Drawing" is followed by a numeric character.
    This would force a saveas in any file you open which has a name like that.
     
    Tom Smith, Feb 22, 2005
    #15
  16. MiD-AwE

    MiD-AwE Guest

    The issue I was addressing was that after the template had been opened automatically @ ACAD startup, at least one draftsman had on several occasions begun drawing immediately without saving the DWG as the Job name. This has been resolved with the help of this message board by simply displaying the saveas dialogue before the draftsman has the opportunity to begin drawing. thereby making it easier and more productive for the draftsman to save the drawing before drawing on the template.

    The most recent solution is just as valuable as the one previous and I find it most interesting for the use of wild card test. Very informative! Thank you, I'm sure I'll find a use for the syntax in the future.
     
    MiD-AwE, Feb 22, 2005
    #16
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.