Author Topic: Dwg Preview / Thumbnail  (Read 9109 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: 12914
  • 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: 12914
  • 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.

PrinceLISPalot

  • Newt
  • Posts: 36
  • perfectionist trapped inside the mind of an idiot.
Re: Dwg Preview / Thumbnail
« Reply #15 on: April 07, 2014, 10:56:31 PM »
BricsCAD V14 includes additional tools for LISP, including the ability to read and write binary files
http://www.bricsys.com/common/applications/application.jsp?app=720&apploc=1176
See included help on VLE binary read and write functions. Perhaps this would be a way to do this, specifically for BricsCAD?
This of course assumes knowledge of the .dwg file.

BricsCAD Classic does support COM and visual lisp

Upgrade to BricsCAD Pro may be easier than having to overly stress the grey matter ^-^

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Dwg Preview / Thumbnail
« Reply #16 on: April 08, 2014, 02:14:31 AM »
This of course assumes knowledge of the .dwg file.
To extract V14 previews using code similar to maicy's you would also need to know about .png files. Since .png files have compression they are not as easy to understand as 256 color .bmp files.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Dwg Preview / Thumbnail
« Reply #17 on: April 08, 2014, 02:17:24 AM »
Using the 'ObjectDBX' approach there will probably also be a problem with hatch patterns.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dwg Preview / Thumbnail
« Reply #18 on: April 08, 2014, 09:20:16 AM »
Upgrade to BricsCAD Pro may be easier than having to overly stress the grey matter ^-^

Should have gone BrisCAD Pro.

Quote from: David Gregory
I see a pattern emerging.
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 #19 on: April 08, 2014, 08:16:55 PM »
Thanks MP, unfortunately Bricscad Classic will not run DOSLIB, I am looking for another option.

Should have gone BrisCAD Pro.

You need to be careful with that stick, you could poke someones eye out.... :ugly:

exmachina

  • Guest
Re: Dwg Preview / Thumbnail
« Reply #20 on: April 15, 2014, 04:54:15 PM »
The way I understand it, Doslib will extract from the currently opened drawing
and creates a bmp file.
But it seems that BricsCad Classic does not support Doslib...

jar,
More interesting would be a command where you specify a drawing extract the preview
and returns it in the proper format for DCL display.
.. Autolisp Command?
I do not have the BRX|bricsys TX SDK's , do you have the BRX or the bricsys TX SDK's?

This problem (PNG images/Bricscad_Classic_will_not_support_DOSLIB) can be solved easily with a COM library (aka ActiveX) totally independent of bricscad.
If anyone knows another way , please send the code

ymg

  • Guest
Re: Dwg Preview / Thumbnail
« Reply #21 on: April 16, 2014, 09:35:25 AM »
jar,

Quote
.. Autolisp Command?
I do not have the BRX|bricsys TX SDK's , do you have the BRX or the bricsys TX SDK's?

I don't have it, but could probably find it on the web.
I am a complete newbie when it comes to Bricsys but they seem
to recommend going with the BRX SDK's as it is supposed to be completely
compatible with ARX.

You need to register as a developper here http://www.bricsys.com/bricscad/help/en_US/V14/DevRef/index.html?page=source%2FBRX_01.htm in order to download the SDK.

However a little reading on their site states that the SDK is not compatible with "Classic" you need "Pro"
or "Platinum" .

Furthermore some of the required dll are part of the Bricscad installation.  Seems like you need Bricscad
installed on your system in order to develop for it.

I believe you are right, there is no other way than having an interface to a library  (For example "libpng").
You also need "zlib" as libpng is dependent on it.

ymg
« Last Edit: April 16, 2014, 10:37:26 AM by ymg »