查看单个帖子
旧 2009-04-12, 09:20 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how to know the featurebodyparts name if it is selected using mouse

how to know the feature/body/parts name if it is selected using mouse
as topic says.
i just want to get its name if the feature/parts/body is selected with mouse and insert its name into database.
but, the first step to get its name is not easy for me now.
any suggestion will be appreciated!
vb2008.net express
c#,asp.net,xml
solidworks 2009,driveworks
sql server 2005 express
mastercam x2,fanuc
ansys,cosmos
------------
edmonton,ab
canada
t6j 2n8
edited: 03/06/2009 at 11:52 am by qinghai jin
hey,
try this code:
dim swapp as sldworks.sldworks
dim swselmgr as sldworks.selectionmgr
dim swselection as sldworks.component2
dim swpart as sldworks.modeldoc2
dim swpartname as string
'create solidworks object
swapp = createobject("sldworks.application")
'get active document
swpart = swapp.activedoc
'set the selectionmanager
swselmgr = swpart.selectionmanager
'get the component of selected object
swselection = swselmgr.getselectedobjectscomponent2(1)
'get the name of the component
swpartname = swselection.name2
'show name in messagebox
msgbox(swpartname)

its written in vb.net
should work for you!
local time: 10:14 pm (austria)
edited: 03/06/2009 at 04:13 pm by georg draxler
it works well. thanks! georg
vb2008.net express
c#,asp.net,xml
solidworks 2009,driveworks
sql server 2005 express
mastercam x2,fanuc
ansys,cosmos
------------
edmonton,ab
canada
t6j 2n8
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)