Dwg files preview

I have lots of .dwg files saved in my DTPO databases and most of them have cryptical file names (like D222-B4-P01-0001; not my choice but given accordingly to project conventions).

DT is not showing a preview of .dwg files so navigating through them is sort of a nightmare. With this respect file managers are not doing better and they’re unable to display preview as well.

I realise that this is due to quicklook lacking of support for mentioned files but is there any other way to enable the preview on DT making use of 3rd party viewer engine?

I searched the forum with no luck (to my surprise); am I the only one storing CAD drawing in DT?

There’s no workaround, other than opening your files in their native application or a standalone viewer for .dwg files. If a third party QuickLook generator exists (normally a file with a .qlgenerator extension), then it can be placed in the root library at /Library/QuickLook. Over here, I’m using third party qlgenerators for archives and MultiMarkdown, and they work seamlessly in DEVONthink.

DEVONthink itself doesn’t know how to preview anything without QuickLook’s help, except the basic file types you see listed in Data > New – almost every app on the OS X desktop has the same limitation. Have you contacted the supplier of your .dwg software (is it Autodesk), or their forum? There are also 3rd party generator sites such as qlplugins.com that might know if anyone has worked up a generator for .dwg.

Hi korm, tanks for your useful answer.
Unfortunately I was not able to find any QuickLook plugins able to display autocad drawings.

I’m therefore tempted to go for a “brute force” workaround i.e.:

  1. Export a copy of all my DWG files
  2. Convert them to PDF files (on a windows PC)
  3. Import the PDFs into a new group in my DTPO database
  4. Rename the PDFs adding a suffix (to easily find and delete them if needed)
  5. Use a script that go though the new PDF group and for each file:
  • Locate the original DWG (the PDF has the same name except for added suffix and .pdf extension instead of .dwg)
  • Move the PDF in the same group that contains the original DWG

These way I can browse the PDF and, once found one or more interesting drawings, I can open the original DWGs.
It’s also not bad having all the drawing already converted to .pdf for quick printing or mailing to other people.

I tested steps 1-4 on a small number of drawings with good results; needless to say what I’m missing is the script to accomplish step 5 (in particular the part that searches the original DWG).

Any helps or tips? :slight_smile:

Thanks

If a typical name for a .dwg is “D222-B4-P01-0001”, and your PDF of that files is named something like “D222-B4-P01-0001_P”, then you could put “D222-B4-P01-0001.dwg” and “D222-B4-P01-0001_P.pdf” in the same folder, index the folder, and sort by name. The pair will be next to one another. The PDF can be previewed in DEVONthink, and the neighboring file would be the .dwg.

Seems like that procedure might be simpler than what might be a complex script to build, test and debug.

As you noted, having each original DWG and correspondent converted PDF side by side in the same group is exactly my goal.

The problems are:

  1. I will have approx 11700 converted PDF in my group in DTPO
  2. I don’t even know where each PDF must be moved to so I would have to select the PDF name (without suffix and extension) perform a search in DT to find the original DWG and finally move the PDF. One by one!

With that number of files I think the only feasible solution is a script.

I’ve noticed there are some .dwg viewer apps in the App Store – I have no idea how to evaluate them, but perhaps a spec-built viewer app would be a better solution than cobbling together something to associate PDF “previews” in DEVONthink?

Thanks for the hint; I didn’t notice them last time I searched MAS (a few months ago).
I also sent mail to the more promising app developer but I guess none of them will include a QL plugin to enable DT or File mangers preview.

If this is the case I already have a dwg viewer (free and not bad all in all); the problem is this kind of apps are quite slow to show the drawing and since names are not so friendly you have to open a lot of dwg.
Immagine you don’t have preview for text files and all of them must be opened in a heavy word processor every time; for sure a nightmare scenario.

Anyway, I arranged a script to perform step 5 of my previous post and tested it on a dozen of files.
It woks fine but:

  • doing the same on thousands of files is not the same
  • conversion to pdf is the hard part of the process

Here’s my simple script:


tell application id "com.devon-technologies.thinkpro2"
	set nameSuffix to "-testXX"
	set nameSuffixLenght to length of nameSuffix
	set nameTailLenght to nameSuffixLenght + 4
	set theSelection to the selection
	if theSelection is {} then error "Please select some files to move."
	
	try
		
		repeat with thisRecord in theSelection
			if type of thisRecord is not group then
				set thisName to (name of thisRecord as string)
				set thisNameLenght to length of thisName
				set thisNameStrip to characters 1 thru (thisNameLenght - nameTailLenght) of thisName as string
				set searchString to "\"" & thisNameStrip & ".dwg\""
				
				
				set searchResult to search searchString in root of current database within titles
				
				if length of searchResult is 1 then
					set destinationGroup to parent 1 of item 1 of searchResult
					
					display dialog "file: " & thisNameStrip & "
Tags: " & tags of destinationGroup buttons {"Cancel", "OK"} default button 2
					
					move record thisRecord to destinationGroup
				end if
				
			end if
		end repeat
		
		
	on error error_message number error_number
		if the error_number is not -128 then
			try
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
	
end tell


I used the dialog as a sort of debug and to see if, at least, files are moved to the right project.

The good part of the method is the dummy PDFs have the special suffix and can easily be deleted any time.

PS off topic:
PDFs are obviously not OCRed and must be so. Here again pdf files manipulation using PDF kit framework (e.g. ABBYY in DTPO) shows unbearable limits: files get 8 times bigger (conversion from bw to grey scale I think) and, even worse, they loose contrast and become difficult to see in a small preview window (an ISO A0 is “zoomed” at about 10%).
Acrobat is the only app that is managing OCR giving decent results with PDF image layer but ABBYY/DT gives for sure better text recognition results.