error: Exception occurred: 0xC0000005 (Access Violation)

Discussion in 'AutoCAD' started by Ken Alexander, Feb 19, 2004.

  1. Using the snippet of code below, I get this error only on some
    layouts (not Model). Anyone seen this?

    Restoring cached viewports - Regenerating layout.
    Regenerating 948 modified entities.
    ; error: Exception occurred: 0xC0000005 (Access Violation)
    ; warning: unwind skipped on unknown exception

    (setq plotobj (vla-get-plot *adoc*))
    (foreach x laylist
    (setq l-out (vla-item *layouts* x))
    (vla-RefreshPlotDeviceInfo l-out)
    (vla-put-configname l-out (dos_getprn))
    (vla-put-canonicalmedianame l-out "11x17")
    (vla-put-activelayout *adoc* l-out)
    (vla-plottodevice plotobj nil)
    )

    --
    Ken Alexander
    Acad2004
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein
     
    Ken Alexander, Feb 19, 2004
    #1
  2. Ken Alexander

    Mark Propst Guest

    Hi Ken,
    I've seen that error (or very similar) more than once but don't remember the
    exact situations.
    As you well know, you could wrap each vla statement in a catch all apply
    then read back the error-message to see which ones triggering it...course
    that may not explain why but it may give a direction to look...
    is the error consistent with the certain layouts? is it happening in a long
    loop of dwgs? couldn't be some weird memory issue?
    obviously you've confirmed each item in laylist is a valid layout
    name...hmmm what else could it be?


    (defun testforken()
    ;(or Getlayoutlist(load"LayoutFuncs"))
    (setq plotobj (vla-get-plot *doc*))
    ;(setq laylist(GetLayoutList))
    ;(or usedoslib (load"UtilFuncs"))
    ;(usedoslib)
    (foreach x laylist
    (if(vl-catch-all-error-p
    (setq l-out
    (vl-catch-all-apply
    'vlax-invoke-method (list *layouts* 'item x)))
    );err
    (princ(vl-catch-all-error-message l-out))
    (princ"\nItem method ok")
    )
    (if(vl-catch-all-error-p
    (setq res
    (vl-catch-all-apply
    'vla-RefreshPlotDeviceInfo (list l-out))))
    (princ(vl-catch-all-error-message res))
    (princ"\nRefreshPlotDeviceInfo ok")
    )
    (if(vl-catch-all-error-p
    (setq res
    (vl-catch-all-apply
    'vla-put-configname(list l-out (dos_getprn)))))
    (princ(vl-catch-all-error-message res))
    (princ"\nput-configname ok")
    )
    (if(vl-catch-all-error-p
    (setq res
    (vl-catch-all-apply
    'vla-put-canonicalmedianame (list l-out "Letter"))));I had to change
    to letter for this printer
    (princ(vl-catch-all-error-message res))
    (princ "\nput-canonicalmedianame ok")
    )
    (if(vl-catch-all-error-p
    (setq res
    (vl-catch-all-apply
    'vla-put-activelayout (list *doc* l-out))))
    (princ(vl-catch-all-error-message res))
    (princ"\nput active layout ok")
    )
    (if(vl-catch-all-error-p
    (setq res
    (vl-catch-all-apply
    'vla-plottodevice (list plotobj nil))))
    (princ(vl-catch-all-error-message res))
    (princ"\nplot to device ok")
    )

    )
    (princ)
    )

    returned
    Item method ok
    RefreshPlotDeviceInfo ok
    put-configname ok
    put-canonicalmedianame ok
    put active layout ok
    plot to device ok

    for both layouts of a test dwg
    I had previously plotted from the two layouts manually to set the plot
    device
     
    Mark Propst, Feb 20, 2004
    #2
  3. Mark,

    It's not consistent with certain layouts. At least I don't think
    so. I don't get the error but one or two times every couple weeks.
    I use this routine daily. Laylist is valid. I'm leaning toward one
    of two things. 1) I used this routine for almost a year using
    Acad2000 and dos_lib 2k. No problems Now I'm using Acad2004 and
    dos_lib 2004. Maybe something there. 2) Memory. I've got 512 meg
    and 4X that in virtual Memory.

    Hard to pin point a cause. Thanks for your time on this.

    --
    Ken Alexander
    Acad2004
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    happening
    in a long
    had
    to change
     
    Ken Alexander, Feb 20, 2004
    #3
  4. Ken Alexander

    liftedaxis Guest

    Ken,
    I get those a lot, they seem to be related to a database conflict. 90+% of the time, reinstalling MDAC fixes the problem. go to microsoft.com, search for mdac, and download and install version 2.8.
    --Jeremiah
     
    liftedaxis, Feb 20, 2004
    #4
  5. Thanks Jeremiah, I give it a look.
    --
    Ken Alexander
    Acad2004
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    90+% of the time, reinstalling MDAC fixes the problem. go to
    microsoft.com, search for mdac, and download and install version 2.8.
     
    Ken Alexander, Feb 23, 2004
    #5
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.