set objects to nothing

Discussion in 'AutoCAD' started by elefebvre, Jun 17, 2004.

  1. elefebvre

    elefebvre Guest

    hi,

    my program is starting to work slower and slower. I heard from someone that i need to set my variables to nothing at the end of each procedure. I thought that variables automatically lose their value and their appointed space when a routine finishes? So do i have to set all the variables to nothing? or just certain types?

    Emmanuel
     
    elefebvre, Jun 17, 2004
    #1
  2. Gets slower doing what ?


    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica

    that i need to set my variables to nothing at the end of each procedure. I
    thought that variables automatically lose their value and their appointed
    space when a routine finishes? So do i have to set all the variables to
    nothing? or just certain types?
     
    Jorge Jimenez, Jun 17, 2004
    #2
  3. elefebvre

    elefebvre Guest

    when i first start acad and run the program it runs pretty fast. after several times it starts to run slower and slower. when i restart acad, it runs fast again. The program mainly inserts blocks with attributes, zooms, highlights, opens and closes forms etc.
     
    elefebvre, Jun 18, 2004
    #3
  4. What you're describing sounds like when you run out of memory and disk
    paging steps in, but then AutoCAD and any other running app should crawl
    also.
    Doesn't seem like something a normal VBA macro could do, unless you're
    looping over every entity in the drawing many times , and as the dwg gets
    bigger the the loop gets longer.

    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica

    several times it starts to run slower and slower. when i restart acad, it
    runs fast again. The program mainly inserts blocks with attributes, zooms,
    highlights, opens and closes forms etc.
     
    Jorge Jimenez, Jun 18, 2004
    #4
  5. elefebvre

    cascadtx Guest

    Look at the help for the UNDOCTL system variable and the UNDO command.
     
    cascadtx, Jun 22, 2004
    #5
  6. elefebvre

    elefebvre Guest

    i looked at it, but what does it have to do with my program slowing down?
     
    elefebvre, Jun 22, 2004
    #6
  7. elefebvre

    Anthony Ryan Guest

    I has to do with when you create objects, memory is allocated for that
    object with a reference to the AutoCAD application. When your program
    keeps on running with the creation of objects it starts to slow down
    for autocad first and then for the rest of the operating system if
    none of the objects are destroyed.

    As stated before when AutoCAD is closed down and restarted the program
    runs fast again is because when autocad is shut down all memory
    references associated with the application are wiped.


    In my experience with excel, word and autocad at the end of all
    procedures/error trapping, I destroy all of the objects that I have
    created and erase all arrays as well by the following:

    Set object = Nothing
    then followed by a small time delay (eg 200ms) to allow the operating
    system/program time to destroy the object properly

    and

    Erase array
    then followed by a small time delay as well



    I hope this helps

    Anthony
     
    Anthony Ryan, Jun 23, 2004
    #7
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.