+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    May 2012
    Posts
    5

    Default Processing of multiple drawings - Script ends after first drawing

    Registered forum members do not see this ad.

    I am running a script to process many drawings, and the script ends after the first drawing. I have tracked down the issue but do not know how to work around it:
    (c:test1 "10.DWG") _.open "10.DWG" (c:test2) _.qsave _.close
    (c:test1 "11.DWG") _.open "11.DWG" (c:test2) _.qsave _.close
    ...

    The problem seems to be trying to issue any command other than "open" after the initial drawing is loaded and closed. If I remove the "(c:test1)" from all lines after the 1st line, then it works fine. The details of test1 don't really matter, I've tried using a built-in AutoCAD command instead and the same problem happens.

    It's as if AutoCAD won't process any more script commands unless you immediately open another drawing after closing the previous one, in case the script closed the last drawing and there are no more open drawings to execute commands against. But that is not the case, Drawing1.dwg remains open the whole time.

    Since Drawing1.dwg remains open the whole time, I thought if I could find a command to "activate" or make it "current" again, then perhaps I could issue the test1 command prior to opening the next drawing, something like:

    activate "Drawing.dwg" (c:test1 "11.DWG") _.open "11.DWG" (c:test2) _.qsave _.close

    However, I've researched and cannot find any such "activate" command.
    FYI - I need to run the test1 function on the filename prior to opening the drawing.

    Any ideas on how to resolve this would be greatly appreciated. Thanks.

  2. #2
    Luminous Being
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    5,137

    Default

    When you open another dwg you transfer control to that dwg now so any new programs are run on that dwg and ignore prior dwg you would need to do some sort of change back to drawing1 if you want to do something in that dwg and bring it into the next dwg. What is C:test1&2 doing ?
    A man who never made mistakes never made anything

  3. #3
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    May 2012
    Posts
    5

    Default

    Thanks for the reply. So I hope there is a way and someone can help with how to transfer control back to Drawing1 after closing a drawing. Test1 is doing some processing with a remote database using the filename, so it only needs the drawing filename, does not need the drawing open. Test2 is doing standard stuff on the drawing (turn layers on/off, etc.). The details of the functions don't seem to matter, same issue happens if I remove test2 and replace test1 with some standard AutoCAD command.

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,942

    Default

    Then how about doing the processing in two steps: (1) run a script in an empty drawing to perform the said database validation and (2) after run the processing script on the entire bunch?
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  5. #5
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    May 2012
    Posts
    5

    Default

    I had thought about that and it is my plan B, but would be preferable to get it working in one step if possible, so that each drawing can be dispatched to a different business process without having to wait for the first step, which will take a long time (thousands of drawings). If it's just a simple matter of a command I need to insert (or something) to transfer control to Drawing1.dwg, then I would go that route.
    Thanks.

  6. #6
    Forum Newbie
    Using
    Civil 3D 2012
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    5

    Default

    Is there any reason you are not using scriptpro or autoscript?

  7. #7
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell
    CPU:
    Intel Xeon E5-1603@2,80GHz
    RAM:
    4GB
    Graphics:
    NVIDA Quadro K600
    Monitor:
    DELL 23" & SAMSUNG 21"
    Discipline
    Electro/Mech
    dbroada's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Electro/Mech
    Using
    Electrical 2013
    Join Date
    Nov 2005
    Location
    Sussex, UK
    Posts
    5,507

    Default

    Registered forum members do not see this ad.

    without reading everything you have done I run my scripts in SDI mode and finish with
    Code:
    qsave
    open <drawing name>
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson
    "Everything in drafting is logical. Except what isn’t." - Gavin Guile. (from the Lightbringer series of books by Brent Weeks)

    Dave

Similar Threads

  1. Drawing a line with one or two arrow ends
    By titech in forum AutoCAD General
    Replies: 15
    Last Post: 25th Oct 2012, 12:29 pm
  2. Insert a block in multiple drawings using script
    By Arek80 in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 8
    Last Post: 14th Dec 2011, 03:02 am
  3. Lisp or Script - Procedure on Multiple Drawings?
    By ILoveMadoka in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 22nd Aug 2011, 03:43 am
  4. Drawings form Multiple sources (multiple xrefs)
    By Gila in forum CAD Management
    Replies: 2
    Last Post: 28th May 2008, 03:17 pm
  5. Where one point on a drawing ends up on another
    By Siberian in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 28th Jul 2006, 12:26 pm

Bookmarks

Posting Permissions

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