几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   【转帖】solidworks preview in visual studio 2005 (http://www.dimcax.com/hust/showthread.php?t=5769)

yang686526 2009-04-13 02:33 PM

【转帖】solidworks preview in visual studio 2005
 
solidworks preview in visual studio 2005
is it possible to show the preview of a solidworks file in visual studio 2005 form?
sldworks:getpreviewbitmap does not work outside solidworks application
any other way to display?
mathew varghese
flowserve
nope. the only way is to create a dll class library structured as a sw addin and add a public function that accepts your required parameters (model path, configuration name etc...) and then get the preview bitmap, save it to a file and return the saved path back to the calling object. make the class com visible, then from your app get the addin class object (getobject()), call the public function, and read in the bitmap from the saved location.
of course if you want to get even more complex you can just use windows low level system hooks to hook into the sw running instance, get a handle to the window class and call a win32 function to get that handles viewable area as an image stream.
both of these methods are fairly advanced so unless you understand what i have just said i wouldn't attempt it!
could always use the edrawings api to open the sw file assuming your clients are selecting some kind of file...
quick


所有的时间均为北京时间。 现在的时间是 12:53 PM.