• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Active Contributor
    Posts: 30
    Registered: ‎09-13-2012

    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

    Please use plain text.
    Active Contributor
    Posts: 30
    Registered: ‎09-13-2012

    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.

     

     

     

     

     

    Please use plain text.
    *Expert Elite*
    Posts: 6,460
    Registered: ‎06-29-2007

    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
    -------------------------------------------------------------------------
    Please use plain text.
    Active Contributor
    Posts: 30
    Registered: ‎09-13-2012

    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

    Please use plain text.
    *Expert Elite*
    Posts: 6,460
    Registered: ‎06-29-2007

    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
    -------------------------------------------------------------------------
    Please use plain text.
    Active Contributor
    Posts: 30
    Registered: ‎09-13-2012

    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

    Please use plain text.
    *Expert Elite*
    Posts: 6,460
    Registered: ‎06-29-2007

    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
    -------------------------------------------------------------------------
    Please use plain text.
    Active Contributor
    Posts: 30
    Registered: ‎09-13-2012

    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

     

     

    Please use plain text.
    *Expert Elite*
    Posts: 6,460
    Registered: ‎06-29-2007

    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
    -------------------------------------------------------------------------
    Please use plain text.
    Active Contributor
    Posts: 30
    Registered: ‎09-13-2012

    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

     

    Please use plain text.