Display DWG in Access 2010

Display DWG in Access 2010

Anonymous
Not applicable
1,360 Views
6 Replies
Message 1 of 7

Display DWG in Access 2010

Anonymous
Not applicable

I have been searching the web off and on for 2 months now looking for a way to do this. I just can't find anyone else in my delima.

 

What is needed to accompish this?

 

I'm moving someone from Aproach to Access. In approach, they have a form they can cycle through every product, and each product will display the image from Autocad...

 

This is the only function i've yet to mimic.

 

I have ecperiance in VBA, so dont hold back the code.

 

This needs to work on Windows 7 and up. Acces 2010 and Up

 

 

0 Likes
Accepted solutions (1)
1,361 Views
6 Replies
Replies (6)
Message 2 of 7

norman.yuan
Mentor
Mentor

You cannot directly display Dwg anywhere outside AutoCAD 😞

 

With that said, I suspect you actually want it is the display drawing file's preview image in your ACCESS's form, which is doable. If you search the internet, you may be able to find some code sample (but it may not be VBA Code, though) that can extract bitmap/png preview image from *.dwg file, then you can display the image in your form. Also, just a reminder, a *.dwg file may or may not have a preview image saved in the drawing file, depending on how the drawing is saved. There is also used to be a activeX control that shows drawing file previoew image, which can be used directly in VBA. However, I am not sure if it is still available.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 7

Anonymous
Not applicable

Yes, displaying the preview is what I want, as well as opening the autoCAD file it's self when the preview is clicked.

 

I've yet to find anything that works. I found some code but it's most likely for use within autoCAD since it's using objects that I don't have. like

 

  ThisDrawing.Application.Documents.Open dwgName

 

If anyone knows more I'd appreciate it. 

0 Likes
Message 4 of 7

Anonymous
Not applicable

Still in high need of support

0 Likes
Message 5 of 7

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

>> In approach, they have a form they can cycle through every product, and each product will display the image from Autocad...

Where the images stored within "Approach" or were they created on demand ... if so show us the code so we know what happend previoulsy.

 

From your last post:

>> Yes, displaying the preview is what I want

This is what is not clear now, as Norman mentioned AutoCAD can save a small image from the last view, but that might be turned off. So you can't count on that and you would have to create a preview on demand or you do that in the background as an update process when drawings where changed.

Also a question: a drawing might have 10 layouts, ... which one would you like to show in your preview ... or are there any other rules?

 

>> as well as opening the autoCAD file it's self

You might search through >>>that links<<< showing the search result for AutoCAD + CreateObject + ...

There are tons of code available for how to start AutoCAD and then how to open documents. If you have troubles with that please show more of your code than just one line captured anywhere without a context.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 6 of 7

Anonymous
Not applicable

Thanks for the reply.

 

I'm affraid I don't have any code to share yet as I have yet to find an example out there for displaying the preview. At least not for VBA. I found an articve about "AutoCad DwgThumbnail", but it seems the example is more based for Excel and when checking my Excel I didnt have anything for Autocad in there. http://visiblevisual.com/jupgrade/index.php/autocad-vb-vba/136-preview-dwgfiles-using-the-dwgthumbna...

 

For Access the closest I got was displaying a OLE object of a DWG. Which also means everything has to be loaded manually by the user. However, that is more of a topic for Access forums.

 

For the layouts, I assume we're using only 1. I could ask the person who designs them for further details. If there are more than 1 layer, is there a default/main layer?

 

if I remember correctly, the drawing should just be linked in aproach. I asume each record in the table has a relative path (or just the  file name). They can surf through records on a form and see the drawing that is ascociated with it. They can then choose to click that preview and they will then open up the dwg for editing.

 

As far as opening the DWG. The easiest way to do so is using actual commands in Command promp.

 

1 Create a batch file and inside it just type "%1"

2 Save the batch file as openDWG.bat

3. In VBA use the command 

"Call Shell([PATH]\"openDWG.bat" & " " & [name of the dwg])"

 

 

0 Likes
Message 7 of 7

Anonymous
Not applicable

I have found ways of doing this using DWGthumbnail  and DwgViewerrAc. I assume third party viewers are also options.

 

 

Thanks for the help!!!

 

 

Cheers

0 Likes