See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Assistance in saving drawing files to a certain directory

  1. #1
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Assistance in saving drawing files to a certain directory

    Can anyone assist me ?
    It would be greatly appreciated.

    I am very new to the writing of lisp routines and resourcing info on doing so the best i can but getting stuck in some places. Here is the area i am needing assistance with.

    I am trying to save the drawing i have opened to another directory, not to hard and can do that. The problem is I have the files arranged in folders under "job names\drawings\incoming\date" and i can extract using the dwgprefix & dwgname the files location and name to use but i want to save a copy of the file into the "job names\drawings" folder with the same name. So how do i remove with lisp the "\incoming\date" folders from that information ?

    If anyone had the patience to explain to me how to complete this task i would be most greatful.

    Regards

    stephen

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Assistance in saving drawing files to a certain directory

    Quote Originally Posted by stephen.coff
    . . . So how do i remove with lisp the "\incoming\date" folders from. . .
    strcat merge strings together

    Code:
    (strcat  "\\job names\\drawings\\" (getvar "DWGNAME" ) )
    ---> "\\job names\\drawings\\MyDrawing.dwg"
    : ) Happy Computing !

    kennet

  3. #3
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Default Re: Assistance in saving drawing files to a certain directory

    Kennett,
    Thanks for the reply.
    I am not sure that i explained myself properly ?

    eg:
    The file opened when the routine is run is in s:\projects\job1\drawings\incoming\a060905\architectural.dwg

    I wish to save a copy of the file under the drawings with the same name, now i can alter this file and prepare it for xrefing into my mechanical files and also keep a copy of the original in the incoming.

    So i use:
    (setq dp (getvar "dwgprefix"))
    (setq dn (getvar "dwgname"))
    (setq dpxrdn (strcat dp "\\XR-A-" dn ))

    This will allow me to save the file with the ammended name though in the same file folder "s:\projects\job1\drawings\incoming\a060905\XR-A-architectural.dwg"

    I want the file to be saved in this location "s:\projects\job1\drawings\XR-A-architectural.dwg".

    I could ammend it just like you did by simply adding in the location though i want the process to be automated and the lisp routine to be able to work it out with any drawing from the incoming folder on any job.

    Thats where i become unstuck, how can i get it to remove the "incoming\a060905\" from the "dwgprefix" information to complete this ?

    Regards

    Stephen

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Assistance in saving drawing files to a certain directory

    Quote Originally Posted by stephen.coff
    . . . how can i get it to remove the "incoming\a060905\" . . .
    Why remove ?
    when you can merge. . .
    Code:
    (command "._saveas" "" (strcat "s:\\projects\\job1\\drawings\\XR-A-" (getvar "DWGNAME" ) ) )
    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2006-09-05 at 07:01 AM.

  5. #5
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Default Re: Assistance in saving drawing files to a certain directory

    Sorry Kennet,
    Maybe i'm not understanding you or seeing it ?

    I would still have read your reply as i did the first one and that if i am correct this correcting it for that situation only.
    Maybe i am wrong but it seems as though it would work only if the files in the incoming folder for "job1". As only these files would be required to be saved to the folder "s:\\projects\\job1\\drawings\\" emphissis on the "job1".
    When i want to run the lisp routin on a drawing in job folder "s:\\projects\\job2\\drawings\\incoming\\a060905\" emphissis on the "job2" folder i wouldn't expect this to work. Wouldn't it save the file to the "s:\\projects\\job1\\drawings\\" or require me the alter the lisp file or have the lisp promt me for a job name ?

    I figured there must be a way for me to modify the information from the "dwgprefix" variable. If this can be done then i should be able to run the lisp routine from any file in any incoming folder and it will land under the same project and job folders though in the drawings folder rather the incoming.

    If i am wrong and this will do that, could you please explain to me whats happening. just so i understand whats going on rather just typing away, at the moment i don't see it.

    Regards

    Stephen

  6. #6
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Assistance in saving drawing files to a certain directory

    Quote Originally Posted by stephen.coff
    Sorry Kennet,
    Maybe i'm not understanding you or seeing it ?
    . . . or I.
    Code:
    (if (vl-string-search "\\incoming\\" (getvar "DWGPREFIX" ) )
      (strcat (substr (getvar "DWGPREFIX" ) 1 (1+ (vl-string-search "\\incoming\\" (getvar "DWGPREFIX" ) ) )) (getvar "DWGNAME" ) )
      (alert "incoming not found in path" )
    )
    : ) Happy Computing !

    kennet

  7. #7
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Re: Assistance in saving drawing files to a certain directory

    Thank you Kennet.
    Looks much better, yet to try it though sure that will be the missing link !

    Whilst it is probably very obvious that i am a little out of my depth, is it possible for yourself or someone else to tell me what i am doing wrong here.

    Code:
    (defun c:send (/ dp bd td dn nn)
     (setvar "cmdecho" 0)
     (setq dp (getvar "dwgprefix"))
     (setq bd (menucmd "M=$(edtime,$(getvar,date),YY.MO.D)"))
     (setq td (strcat bd "\\"))
     (setq dn (getvar "dwgname"))
     (setq nn (strcat dp td dn))
     (command "-layer" "lock" "*" "")
     (setvar "tilemode" 1)
     (command "zoom" "extents")
     (command "view" "s" "DSA")
     (command "purge" "a" "*" "n")
     (command "audit" "y")
     (command "save" fn "y")
     (command "-etransmit" "ch" "DSA Mechanical" "c" nn )
     (setvar "cmdecho" 1)
     (princ)
    )
    Whilst i am expecting a few laughs as i am sure there is a much easier way. It all seems to work other than the last, last part of placing the file name. I have set the variable "nn" to the file name and location i would like and tested it, it does work but not sure how to get that info to the command line. I'm sure it something simple that the simpleton can't see.

    Regards

    Stephen

    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Opie; 2006-09-05 at 01:31 PM. Reason: [CODE] tags added, see moderator comment

  8. #8
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Assistance in saving drawing files to a certain directory

    Quote Originally Posted by stephen.coff
    . . . how to get that info to the command line. . .
    Code:
    (princ (strcat "file " fn "-etransmitted to " nn  ) )
    : ) Happy Computing !

    kennet

  9. #9
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Re: Assistance in saving drawing files to a certain directory

    Kennet,
    i am really sorry to keep bothering you though most greatful of your time and patience.

    I have played with your reply a few times though not sure how to improvise it in the lisp file.
    Sorry to consume your time Kennet, finding it very frustrating as i am sure you are.
    Greatly appreciated though.

    Regards

    Stephen

  10. #10
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Re: Assistance in saving drawing files to a certain directory

    Sorry Kennet,
    Here is the lisp file again and your responce.

    Code:
    (defun c:send (/ dp bd td dn fn nn)
     (setvar "cmdecho" 0)
     (setq dp (getvar "dwgprefix"))
     (setq bd (menucmd "M=$(edtime,$(getvar,date),YY.MO.D)"))
     (setq td (strcat bd "\\"))
     (setq dn (getvar "dwgname"))
     (setq fn (strcat dp dn))
     (setq nn (strcat dp td dn))
     (command "-layer" "lock" "*" "")
     (setvar "tilemode" 1)
     (command "zoom" "extents")
     (command "view" "s" "DSA")
     (command "purge" "a" "*" "n")
     (command "audit" "y")
     (command "save" fn "y")
     (command "-etransmit" "ch" "DSA Mechanical" "c" nn)
     (setvar "cmdecho" 1)
     (princ)
    )
    (princ (strcat "file " fn "-etransmitted to " nn ) )

    After reading my message.
    It should have said:

    "I have played with your reply a few times though not sure how to implement it in the lisp file".

    Regards

    Stephen

    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Opie; 2006-09-05 at 01:33 PM. Reason: [CODE] tags added, see moderator comment

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 2012-08-08, 10:13 AM
  2. Replies: 4
    Last Post: 2007-05-23, 04:37 PM
  3. Replies: 13
    Last Post: 2007-01-11, 01:28 PM
  4. Replies: 3
    Last Post: 2006-02-11, 02:20 PM
  5. 2006 Customization - Assistance with CUI files, Workspaces etc.
    By c_rado in forum AutoCAD Customization
    Replies: 1
    Last Post: 2005-06-23, 06:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •