PDA

View Full Version : VBA drawing thumbnail



Rafurious
2018-10-17, 04:53 PM
I have VBA macro in excel that extracts and modifies the attributes of a block in the drawing, however the thumbnail is gone when it save as the drawing. Is there a way to keep the previous thumbnail when I save as?

Ed Jobe
2018-10-17, 06:02 PM
No, there is no api for working with the preview. It simply saves the current view upon saving the dwg. The best you can do is save the view when you open it, pan/zoom around as you wish, then restore the view before saving.

Rafurious
2018-10-21, 12:46 AM
Oh ok thanks

Rafurious
2018-10-24, 12:29 PM
No, there is no api for working with the preview. It simply saves the current view upon saving the dwg. The best you can do is save the view when you open it, pan/zoom around as you wish, then restore the view before saving.

I don't have a strong programming background, if I am understanding this correctly i can't keep the thumbnail using DBX. I made another code not in DBX. I am opening the drawings make the modification I need and I then zoomextent, save and close. But the thumbnail still does not show in explorer. Please let me know if I am going about it incorrectly. I am just in need an automate way that would keep/generate a new thumbnail for the drawing



Dim AcadApp As AcadApplication

'Open Drawing
'Do some other stuff
AcadApp.ActiveDocument.ActiveSpace = acPaperSpace
AcadApp.Application.ZoomExtents
AcadApp.ActiveDocument.Save
AcadApp.ActiveDocument.Close

Ed Jobe
2018-10-24, 03:45 PM
You didn't mention ObjectDBX before. It doesn't save the preview because the drawing editor is not open for it to get an image. You have to use an full open instance of acad to save the preview.

Rafurious
2018-10-24, 05:04 PM
I figured out what my issue is: :-|


Sub test()

ThisDrawing.ActiveSpace = acPaperSpace
ThisDrawing.Application.ZoomExtents

ThisDrawing.Application.ActiveDocument.Save 'this won't save a thumbnail preview

ThisDrawing.SendCommand ("qsave" & vbCr) 'this would save thumbnail preview

End Sub