几何尺寸与公差论坛

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

【转帖】extract custom property from selected part in drawing view

[复制链接]
发表于 2009-4-13 10:51:25 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 22:20 , Processed in 0.195694 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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