几何尺寸与公差论坛

 找回密码
 注册
查看: 625|回复: 0

【转帖】humbnail

[复制链接]
发表于 2009-4-12 22:39:37 | 显示全部楼层 |阅读模式
thumbnail
hi everyone
anna wood suggested i come here to see if someone could help.
point one:
i would like to get sw to update the thumbnail ever time i hit the save.
point two
i have a part number creation spread sheet in excel and i would like to have a picture ref to the thumbnail for prt, ass and drw.
anna suggested that it would take a api in excel or something to achieve it. i have very little knowledge of such things could someone help?? ,,,,,,, please
i love to design
doug@saol.com
as for the first request; i could swear there was a simple check-box in the options somewhere to tell it to update the preview image on save, but for the life of my i cannot find it?
as for the second request. your best bet is to use the document manager to extract the actual bitmap from the files and then place it as the source of a picturebox in excel. you could have this running every time the excel sheet opened or just on a synchronise basis where to save the bitmap to file and reference them. unfortunately this is not exactly a beginners level task so you would probably struggle.
luke,
do you have any experience with this functionality? i got curious and wrote a macro using sldworks::getpreviewbitmap (macro attached). it does work (saves out a bitmap), but contrary to the api help the picture is not the same as what you see in the solidworks "open" dialog. it seems to be just a screenshot of the model window at the time of the last save rather than the nice isometric picture in the dialog. i seem to recall something about the preview image being improved for 2006, 2007, or 2008. maybe that has something to do with it. i haven't tested the document manager function of the same name. another thing i wanted to look at but am not really sure if it will even work for me is sldworks::previewdoc. i only have vba, so i don't know if i'd be able to figure out what to use for the hwnd argument.
i'll get you eh steve, if it's the last thing i dooooo!
edited: 01/16/2009 at 08:28 am by josh brady
yes the previewdoc, getpreviewbitmap, and dm getpreviewbitmap all pull in the same data and it should be correct. it is more likely that the open dialog is either pulling in a configuration specific preview, or a cached version so the two mismatch.
thanks ........ i think
josh the macro works, at first i thought it was not working till i fond the bitmaps in the same folder as the file.
sorry, is everyone saying that one can not write a vba in excel to do the same as this macro, which could then save to a selected cell?
i love to design
doug@saol.com
edited: 01/16/2009 at 09:40 am by doug davey
did you try out the macro i posted? i get the general preview and the previews for each configuration. it is definitely pulling in a screenshot of the last-saved view of the model or drawing. the size of the bitmap is even exactly the same size pixel-wise as the model window. if i zoom/pan/rotate and then save the model/drawing and pull the bitmap again it reflects the new screenshot. i guess there's no way to access the pretty isometric view that shows up in the open dialog and on the ctrl-tab thumbnail preview?
i've attached a version that uses the document manager. add license key string and stir.
i'll get you eh steve, if it's the last thing i dooooo!
can you even put a picture into a cell? i can't see how to insert any picture into a cell of a spreadsheet, via programming or manually.
i'll get you eh steve, if it's the last thing i dooooo!
activesheet.range("g10").select
activesheet.pictures.insert( "path\name.jpg" )
i have attached josh's sw macro as excell macro.
you must make reference to "c:\program files\common files\solidworks shared\swdocumentmgr.dll"
and you need access key for document manager from
note that this code just dumps the picture on top of the excel sheet with its top-left corner in the selected cell. it does not put the picture in a cell.
i'll get you eh steve, if it's the last thing i dooooo!
originally posted by: josh brady
note that this code just dumps the picture on top of the excel sheet with its top-left corner in the selected cell. it does not put the picture in a cell.
that is true
i can design an aircraft but you seem to have me over a log. i am so grateful for you help .... really mean that.
what and where is document manager?
how do i ask for an access key?
again thank you so much for your help, if you ever need something designed, i would love to help.
thank you josh. thank you ivan and thanks everyone else
i love to design
doug@saol.com
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 18:49 , Processed in 0.036367 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表