几何尺寸与公差论坛

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

【转帖】how to know the featurebodyparts name if it is selected using mouse

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

本版积分规则

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

GMT+8, 2024-12-23 10:38 , Processed in 0.036185 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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