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

    .NET

    Reply
    *Expert Elite*
    Posts: 6,475
    Registered: ‎06-29-2007

    Re: Problem with PaletteSet location in Autocad

    11-20-2012 01:19 AM in reply to: ZK_BUDiKOM

    Hi,

     

    have you found that blog:

    >>>Database.ThumbnailBitmap returns Nothing when called for a side database<<<?

    I think that will be the answer.

     

    - 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 02:31 AM in reply to: alfred.neswadba

    Hi alfred,

     

    I have no idea what is wrong in this project :smileyhappy:

    I changed like this:

    public System.Drawing.Bitmap get_image_of_file(string filename)
    {
    //create a new database instance and load the dwg file into it.
    Database dbb = new Database(false, true);
    //dbb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, false, "");
    dbb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndReadShare, true, "");
    MessageBox.Show(filename);
    //grab the thumbnail bitmap and get rid of the white background
    System.Drawing.Bitmap preview = dbb.ThumbnailBitmap;
    // preview.MakeTransparent(System.Drawing.Color.White);
    
    return preview;
    }

    and it did not work. Error is the same.

    Messagebox show me path to DWG file - is correct.

     

    But I thank you for your patience and help :smileyhappy:

     

    My control "Palette" look like:

     

    in AutoCAD (during run & debug), my Palette look like:

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

     

    no label.control, no background.color - This is weird, do not you think?

    Maybe I do something wrong in other place?

     

    regards

     

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

    Re: Problem with PaletteSet location in Autocad

    11-20-2012 10:06 AM in reply to: ZK_BUDiKOM

    Hi,

     

    do you have an older version of AutoCAD? I did test the attached project in debug-mode (with AutoCAD 2010) and it shows the preview icon. Update the references and verify it on your system.

     

    -.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 11:56 PM in reply to: alfred.neswadba

    Hi Alfred,

     

    I don't have AutoCAD2010, but I did test in AutoCAD2012.

    It's work good, but... I noticed that some of the blocks are correct, others do not.

    In attached are two blocks: 2010 not read, 2011 read.

    Maybe here is the problem, not in program?

     

    regards

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

    Re: Problem with PaletteSet location in Autocad

    11-21-2012 01:27 AM in reply to: ZK_BUDiKOM

    Hi,

     

    the 2010.DWG is a definition of a dynamic block, so when you open this drawing you get the question like that.

     

     

    When opening your block with your preview-tool I get then this exception:

    makes me thinking that opening a dynamic-blockdefinition is not supported yet by the API (at least with AutoCAD-2010).

     In this case I would understand some difficulties to querying the thumbnail from the db-object.

     

    But the 2011.DWG does work with your preview (at my workstation/with AutoCAD 2010).

     

    - alfred -

    -------------------------------------------------------------------------
    Alfred NESWADBA
    Ingenieur Studio HOLLAUS ... www.hollaus.at
    -------------------------------------------------------------------------
    Please use plain text.