CreateAutoCADOffScreenDevice/GetSnapshot Changes in 2009 ???

CreateAutoCADOffScreenDevice/GetSnapshot Changes in 2009 ???

Anonymous
Not applicable
2,814 Views
20 Replies
Message 1 of 21

CreateAutoCADOffScreenDevice/GetSnapshot Changes in 2009 ???

Anonymous
Not applicable
I have a function (based largely on an ADN example 'Play2') that fails
in certain conditions on 2007/2008 but seems to work fine on 2009+. It
takes a block name and resolution parameters and returns a system bitmap.

The error is:
--------------------------------------------------
Runtime Error!
Program: C:\Program Files\AutoCAD 2008\acad.exe

R6025
- pure virtual function call
--------------------------------------------------

When you open a drawing and call this function (even numerous times)
everything works fine. However if you close and reopen the same drawing
(on 2007/2008) the error occurs immediately on the first call. Is there
possibly something being disposed that shouldn't be, etc. The fact that
it appears to work continuously on 2009+ leads me to suspect something
may have been fixed in AutoCAD?

The code attached is the exact function used, it should be usable and
standalone fairly well with one exception, substitute reasonable
coordinates for "AcdVue.ZoomExtents".

Thanks in advance,

Terry
0 Likes
2,815 Views
20 Replies
Replies (20)
Message 21 of 21

Anonymous
Not applicable
OK, I will be end up needed this type of tool or functions one of these
days, so I guess it is working with no crash - but do not want to spoke to
so again, give it a try with these changes and see if works.-

1. Go back to Kean original code.
2. And add and replace the following:

View gsv = doc.GraphicsManager.GetGsView(vpn, true); // add
using (View view = new View())
{
//gsm.SetViewFromViewport(view, vpn); // remove
view.Viewport = gsv.Viewport; // replace with these two lines
view.SetView(gsv.Position, gsv.Target, gsv.UpVector, gsv.FieldWidth,
gsv.FieldHeight);

Now run your tests.

I went to read line by line what I have on my arx QuickView app, and based
on these lines:
AcGsView *m_pView;

GetActiveViewPortInfo(height, width, ptTargetView, vecViewDir, viewTwist,
true);
m_pView->setView((ptTargetView + vecViewDir), ptTargetView,
AcGeVector3d(0.0, 1.0, 0.0), 1.0, 1.0);

gave me a hint, then went and look on Kean samples and found that he used
that in C#, so give it a try and seems to work now.

Wow....

And thanks Tony, in between your lines, I read go for it - you can do it, I
know that was your intention, thanks!

And nice tip about the usings use implementation, recall seen it some where,
but never put any attention.

So hope, to back to work on the pay stuff... again 🙂

Luis.-

//--
"Terry W. Dotson"

LE wrote:

> Hmm... spoke to soon, it does not crash while having AutoCAD open,
> only when closing... my guess that one of the using that I removed
> might be needed, but will left that for you or other to give it a try
>
With those changes, in my function it does not crash immediately after
opening the drawing but does after it is called a few times or at best
crashes on closing.

I 'think' I've tried all the combinations of Using -vs- Dim and can't
seem to stabilize it, will keep trying.

Thanks for the effort and constructive response.

Terry
0 Likes