Home AutoCad VB Preview DWG files using the DWGThumbnail
20 | 05 | 2012
This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade

Preview DWG files using the DWGThumbnail PDF Print E-mail
User Rating: / 1
PoorBest 
Tutorials

It is possible to preview a drawing from within a form. To do so you first have to add the AutoCad DwgThumbnail Control Module. You can do this by right clicking the toolbox and click Component.

components1

'Select Components'

This will display the components list. Scroll down to the AutoCad DWgThumbnail Control and check it.

components

'Components Window'

Now a new button is added to the toolbox. Select this button to create a DwgThumbnail control.

dwgthumb

'New DWGThumbnail button'

To test it create a Form containing a button called Button1 and a DwgThumbnail Control called DWGthumbnail1.

Add the following code to the form and test it.

Show/Hidden vbnet code

View source
Private Sub Button1_Click()
 
 
 
	Dim DwgPath As String
 
	DwgPath = "C:\Block.dwg" 'Change Block.dwg to a existing drawing
 
 
 
	'Check if the drawing exists
 
	If Fileexists(DwgPath) = True Then
 
 
 
	DwgThumbnail1.DwgFileName = DwgPath
 
	DwgThumbnail1.Visible = True
 
	DwgThumbnail1.BackColor = RGB(0, 0, 0)
 
	End If
 
	End Sub
 
 
 
 
 
	Public Function Fileexists(Fname) As Boolean
 
	If Left(Fname, 4) = " " Then
 
	Fileexists = False
 
	Else
 
	If Dir(Fname) <> "" Then
 
	Fileexists = True
 
	Else
 
	Fileexists = False
 
	End If
 
 
 
	End If
 
	End Function

The results should look like this:

preview

'The Result'

 

Attachments:
FileDescriptionFile sizeDownloads
Download this file (DwgPreview.zip)DwgPreview.zipPreview DWG files in Userforms19 Kb841
 

Comments   

 
0 #5 Guest 2012-02-03 01:56
Hi i need help, i need preview mi dwg file but in vba for applications.
Thanks
Quote
 
 
0 #4 Guest 2011-05-13 08:30
download from internet
Quote
 
 
0 #3 Guest 2011-05-13 08:29
i cant see the draw i receibe an error
DwgFileName = DwgPath here help me please
Quote
 
 
0 #2 Guest 2011-05-13 08:27
me puedes ayudar con este codigo recibo un error DwgFileName = DwgPath
please help
Quote
 
 
0 #1 Guest 2011-02-18 19:34
hey i cant see the autocad dwg thumbnail viewer control in the list....what shall i do??? please help....
Quote
 

Add comment


Security code
Refresh

This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade