.NET

Reply
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 11 of 25 (903 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 05:51 AM in reply to: Alfred.NESWADBA
  • you have set the property "local copy" for the references to "yes" ==> that should be "no"

Where is this position?

 

  • how do you debug your project? When going to project-properties you have not set the "external program to start" to your ACAD.EXE or to the ACCORECONSOLE.EXE.

OK.

I've added acad.exe.

 

After Debug (F5), AutoCAD2013 run and show me the error message:

 

Application does not support just-in-time (JIT)
debugging. See the end of this message for details.

************** Exception Text **************
System.InvalidCastException: Unable to cast object of type 'Autodesk.AutoCAD.LivePreview.PreviewRuleProvider' to type 'Autodesk.AutoCAD.Internal.IPreviewContextProvider'.
at Autodesk.AutoCAD.LivePreview.PreviewContextService.LoadContext()
at Autodesk.AutoCAD.LivePreview.PreviewContextService.get_ContextProvider()
at Autodesk.AutoCAD.LivePreview.PreviewContextManager.OnIdleInitialize(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Autodesk.AutoCAD.ApplicationServices.Core.Application.OnIdle()


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.296 (RTMGDR.030319-2900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
Acdbmgd
Assembly Version: 19.0.0.0
Win32 Version: 19.0.55.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcdbMgd.DLL
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.296 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0

 

 

I load my DLL (netload) and write PREV.

I see My Palette.

I write LDPRV, and error.

 

regards

Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 12 of 25 (895 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 06:08 AM in reply to: ZK_BUDiKOM

OK. I have found this "local copy".
I changed to "False".

Now, F5 (Debbug) doesn't generate an error, but still is when I write LDPRV.

 

 

 

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 13 of 25 (882 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 09:29 AM in reply to: ZK_BUDiKOM

Hi,

 

>> Now, F5 (Debbug) doesn't generate an error, but still is when I write LDPRV.

Ok, then next step is to tell the debugger to stop on all errors. Do that in Visual-Studio ==> pull-down-menu "debug" ==> item "exceptions" (hope that the translation from my German version is ok for that words) and within this dialog check "Common Language Runtime Exceptions".

 

 

Now exceptions raised during code will break the debugger and show you the position where the exception occured.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 14 of 25 (870 Views)

Re: Problem with PaletteSet location in Autocad

11-19-2012 11:33 PM in reply to: Alfred.NESWADBA

It's done.

 

 

 

 

 

I have found description this exception:

http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(EHNULLREFERENCE);k(TargetFr...

 

Do you have any idea what now?

 

regards

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 15 of 25 (866 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 12:12 AM in reply to: ZK_BUDiKOM

Hi,

 

myPreviewBox is never set to an object (never instanciated) as this.Preview is never started.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 16 of 25 (863 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 12:35 AM in reply to: Alfred.NESWADBA

Hmm...

 

in an example was:

/// <summary>
/// Instance of the Preview box
/// </summary>
PreviewBox myPreviewBox;

 

I have changed to:

PreviewBox myPreviewBox = new PreviewBox();

 

and now, the error is here:


 

 

maybe this example is incorrect and I never won't run this project?...

 

regards

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 17 of 25 (860 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 12:44 AM in reply to: ZK_BUDiKOM

Hi,

 

does that happen with all drawings? Have you set your AutoCAD to "not save the thumbnails"?

The error seems to raise when the line above does not return a valid object (variable preview). So either there is no image in the file or the function does not return a bitmap.

(have not tried your code, so that's just guessing)

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 18 of 25 (859 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 12:49 AM in reply to: ZK_BUDiKOM

When I comment this line:

//grab the thumbnail bitmap and get rid of the white background
System.Drawing.Bitmap preview = dbb.ThumbnailBitmap;
//preview.MakeTransparent(System.Drawing.Color.White);

 

program run propertly, but view nothing in "My Palette"...

AutoCAD 2013 - NOT FOR RESALE - [Drawing1.dwg].jpg

 

I added Alert in this place:

Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("\nAlert " + fn.StringResult);
//use the loaded dwg file to update the preview box
myPreviewBox.load_file_preview(fn.StringResult);

 

and show me path to my DWG file - is correct, eg. "c:\Blocks\My_blok.dwg".

 

"does that happen with all drawings?" - Yes.

Have you set your AutoCAD to "not save the thumbnails"? - where can I set this?

 

regards

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 19 of 25 (857 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 12:57 AM in reply to: ZK_BUDiKOM

Hi,

 

>> Have you set your AutoCAD to "not save the thumbnails"? - where can I set this?

Command _OPTIONS ==> tab "Open and Save" ==> button "Thumbnail Preview Settings"

 

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
ZK_BUDiKOM
Posts: 30
Registered: ‎09-13-2012
Message 20 of 25 (854 Views)

Re: Problem with PaletteSet location in Autocad

11-20-2012 01:01 AM in reply to: Alfred.NESWADBA

Hi,

 

Thumbnail Preview Settings.jpg

 

I have the same like you :smileyhappy:

 

regards

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!