Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAD drawing Preview

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,814
JP
Hi all,
Have been looking around for a few days for something definitive but haven't turned up what I'm looking for.
I have a number of CAD drawings that I would like to show a "preview" when in a form. Similar to the way you would show an image using the Image object, (but that object doesn't support .DWG files). I don't need to manipulate them, and I would be ok with something that just shows the image file in an ActiveX or Ole object. Is anyone aware of a way to do this? It would make it nicer than having to launch my external CAD viewer with a SHELLEXECUTE, when I just want to have some visual reference in the form when docs of that type/style are present.
Many thanks.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
It's a bit of a minefield, working with CAD files, but there are a few viewers you can use.

I would Google DWGViewX and see what you find.

CAD stuff can be a pain, because the market leader upgrades pretty regularly and viewers can get behind the curve - i.e. obsolete - quite quickly, plus a DWG file may not be complete without other supporting files (often referred to as xrefs).

I would tend to suggest that PDF versions of CAD files are usually more portable, and don't seem to go out of fashion.

Bear in mind your 'preview' may well take 'ages' to present.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Thanks Griff, I will check that out. And yeah, kind of aware of some of the gatcha's in that regard.
From a PDF standpoint, that's a possibility, easier than taking screen shots of CAD files and then editing them. Do you have a recommendation on how to create PDF preview? As I recall it doesn't just work on the "image" type either (despite Photoshop reading .PDF files natively, but I guess that's Adobe for you).


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Most producers of DWG files can print to PDF, either natively or via a PDF Printer like Cute PDF.

The quality of the produced PDF varies by a very wide margin, particularly where designers combine many drawings in a single CAD model and then print portions to PDF.

If you can get good PDFs, then there are a number of options for previewing them in VFP. I have in the past made JPG thumbnails using imageviewer from Viscom Software.

Sometimes the resultant JPGs are bigger than the source PDFs

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi Griff,
For a large part, we have good control over PDF output from CAD, because we get the CADs from the source creator, and we can output them to PDF in our current CAD viewer (DWGSee). Like I mention, we never alter CADs, we just need to look at them. (We occasionally make comments back to the creators, but never alter them, that's up to them to do). So this is a solution that could work well. So what options are there for VFP PDF view that you think are worthy? Does it actually view the PDF or do you, as you mention, have to make a .JPG from them? That would result in a CAD -> PDF -> JPG chain which seems a bit tedious, unless it could be automated with a drag and drop of the PDF?


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Rather than converting the drawings to PDFs, is there an easy way to convert them to ordinary raster graphic files such as BMPs or JPGs? Can you do that in the CAD package? Or using an external utility? Or perhaps by programmatically taking a screen shot?

If so, then you will be able to use the native VFP Image control. But of course you will need a way of automating the process.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,
I just had a look and our CAD viewer "DWGSee" has export capabilities, but it all becomes very clunky. The way I have image controls set up on forms now is, just drag and drop any acceptable image format on the control, and presto, you have the image available. (It stores the file in a directory utilizing unique key from the table it's associated with), it renames the file to the type of image it's associated with, and places the structure reference into a MEMO filed, with fully qualified path, minus the drive letter, for easy moving of the application.

Two ideal situations then are:
1) Drag and drop the CAD file, let OCR Drop determine the type, and then use the appropriate OLE/ActiveX control to display that file when on the form (so I would have 2 controls over each other, the drag/drop code would determine the file type at the time, and then refresh code would choose which control to make visible, so I could put CAD or Image data in the same "location" (at least visually).

2) Drop a CAD file onto a control that automatically converts it to a .jpg at a size specified (since CAD are scaleable, they don't really have a "size" like an image). I could set a default at like 1920 x 1080 or allow users to pick a size before drop. But the key is, that would all have to happen automatically. I am trying to avoid big time suckers like we have now, which is either screen-shot and then editing them in Photoshop for all the area we don't want, or opening the program, sizing the view, saving the view as some export file, and then dragging and dropping that onto the control (Which is what we're doing now).

So, 2 options, open to either one, but am I reaching too far on this one?


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top