几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】extract custom property from selected part in drawing view (http://www.dimcax.com/hust/showthread.php?t=5335)

yang686526 2009-04-13 10:51 AM

【转帖】extract custom property from selected part in drawing view
 
extract custom property from selected part in drawing view
i am trying to do just as the title states. i have a drawing open with a part selected inside a drawing view. i would like to be able to extract a custom property from the selected part, without opening it in a different window.
here is my code so far:
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swcomp as sldworks.component2
dim swdraw as sldworks.drawingdoc
dim swselmgr as sldworks.selectionmgr
dim swview as sldworks.view
dim swrootdrawcomp as sldworks.drawingcomponent
dim swcompmodel as sldworks.modeldoc2
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swdraw = swmodel
set swselmgr = swmodel.selectionmanager
set swview = swselmgr.getselectedobject5(1)
set swrootdrawcomp = swview.rootdrawingcomponent
set swcomp = swrootdrawcomp.component
set swcompmodel = swcomp.getmodeldoc
msgbox swcompmodel.getcustominfovalue("", "description")
end sub
any help is appreciated.
thanks!
tony szuta
cswa, cswp, cswp-smtl
answer got it!
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swdraw as sldworks.drawingdoc
dim swselmgr as sldworks.selectionmgr
dim swview as sldworks.view
dim swdrawmodel as sldworks.modeldoc2
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swdraw = swmodel
set swselmgr = swmodel.selectionmanager
set swview = swselmgr.getselectedobject5(1)
set swdrawmodel = swview.referenceddocument
msgbox swdrawmodel.getcustominfovalue("", "description")
end sub
tony szuta
cswa, cswp, cswp-smtl
intel core2 quad (q6600 @ 2.40 ghz)
nvidia quadro fx 4600 sdi
solidworks 2008 sp 4.0 (x32 & x64)
solidworks 2009 sp 2.0 (x32 & x64)
quick


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