Author Topic: Dwg Preview / Thumbnail  (Read 9086 times)

0 Members and 1 Guest are viewing this topic.

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Dwg Preview / Thumbnail
« on: April 06, 2014, 03:33:53 PM »
Looking to acquire the thumbnail from a dwg to use as image in DCL. Is there a method to do this in LISP, seems the post I've found here mostly apply to NET.

Much like the image shown in getfiled preview.


MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dwg Preview / Thumbnail
« Reply #1 on: April 06, 2014, 03:37:53 PM »
If memory serves DOSLIB will perform this.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Dwg Preview / Thumbnail
« Reply #2 on: April 06, 2014, 03:58:04 PM »
Thanks MP, unfortunately Bricscad Classic will not run DOSLIB, I am looking for another option.

maicy

  • Mosquito
  • Posts: 12

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Dwg Preview / Thumbnail
« Reply #4 on: April 07, 2014, 04:10:33 AM »
The code in maicy's link may not work for files saved with BricsCAD V14 since that version uses .png drawing previews instead of .bmp previews.

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Dwg Preview / Thumbnail
« Reply #5 on: April 07, 2014, 06:46:29 AM »
The code in maicy's link may not work for files saved with BricsCAD V14 since that version uses .png drawing previews instead of .bmp previews.

That is correct, maicy's code works perfect in ACAD, but does not work for drawings save from BricsCAD. 

Bruce

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dwg Preview / Thumbnail
« Reply #6 on: April 07, 2014, 08:06:44 AM »
Thanks MP, unfortunately Bricscad Classic will not run DOSLIB, I am looking for another option.

Should have gone BrisCAD Pro.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ymg

  • Guest
Re: Dwg Preview / Thumbnail
« Reply #7 on: April 07, 2014, 10:13:21 AM »
As MP stated Doslib will do it:

Here extract of the help file:
Quote
dos_extractpreview

Extracts the thumbnail image from the active document to a bitmap file.
Syntax

(dos_extractpreview filename)
Parameters

filename
The name of the bitmap file to create. The allowable file types are as follows:
 
BMP
Windows Bitmap
JPG
JFIF Compliant
GIF
Compuserve Graphics Interchange
TIF
Tagged Image File Format
PNG
Portable Network Graphics
Returns

A string identifying the created bitmap file if successful.
nil on error.
Example

Command: (dos_extractpreview "C:\\test.bmp")
"C:\\test.bmp"


ymg

exmachina

  • Guest
Re: Dwg Preview / Thumbnail
« Reply #8 on: April 07, 2014, 02:44:18 PM »
... Bricscad Classic will not run DOSLIB...

If Bricscad Classic supports "VisualLisp" i could help you.
I can create a COM library to extract the images.

ymg

  • Guest
Re: Dwg Preview / Thumbnail
« Reply #9 on: April 07, 2014, 03:48:32 PM »
jar,

The way I understand it, Doslib will extract from the currently opened drawing
and creates a bmp file.

More interesting would be a command where you specify a drawing extract the preview
and returns it in the proper format for DCL display.

ymg

Bhull1985

  • Guest
Re: Dwg Preview / Thumbnail
« Reply #10 on: April 07, 2014, 05:14:47 PM »
Or what would be useful is a ribbon to view the current drawing and/or any directories dwg file previews, and dwgnames within autocad for easy click to open.
Now there's a program for you jar.
One image preview in height of bar to be placed right under command line window.
Slide bar left or right to scroll through dwgs and their previews....double click to minimize currently open dwg and open the dwg double clicked on.
Now *THAT* would be sweet.
Challenge!

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Dwg Preview / Thumbnail
« Reply #11 on: April 07, 2014, 06:12:35 PM »
You could use the techniques from this function, in conjunction with ObjectDBX -  though, you may need to exclude objects below a certain size to improve the performance of such a function.

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Dwg Preview / Thumbnail
« Reply #12 on: April 07, 2014, 06:30:07 PM »
Lee,

I would like to use that function, however text is an issue.  The function does not display text. 

Bruce

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Dwg Preview / Thumbnail
« Reply #13 on: April 07, 2014, 06:31:36 PM »

More interesting would be a command where you specify a drawing extract the preview
and returns it in the proper format for DCL display.


This is what I am looking to accomplish.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Dwg Preview / Thumbnail
« Reply #14 on: April 07, 2014, 06:54:29 PM »
I would like to use that function, however text is an issue.  The function does not display text. 

You would need to either calculate a vector representation of every character for every font used in your drawings (whether this be generated on-the-fly or hard-coded beforehand), or explode a copy of all text encountered (TXTEXP), or use the methods Sean demonstrates here to obtain a vector representation.