几何尺寸与公差论坛

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

【转帖】component names

[复制链接]
发表于 2009-4-13 09:48:40 | 显示全部楼层 |阅读模式
component names
hi everyone,
i have an assembly that contains a few sub-assemblies that they contain several components.
is there a way for me to retrieve the name of them components (as this name is seen on the feature manager tree).
i know i can use component2::name2 but that returns the name of the component along with the name of the subassembly and also the unique identifier name given by solid works. i also know how to use string manipulation to get what i want but i thought i should ask here if there is an easier way before i start re-inventing the wheel.
any help/ideas will be much appreciated
cheers,
--stav.
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
stavros
i am curious what you want the name for. i wrote a program that goes through the tree and finds all of the assemblies that has more than one display state and puts them in a list. i can then highlight an assembly and it shows which display states are available in that assembly. clicking on of the states makes it active. i didn't find an easy way to get the name of the assemblies in the tree and i had to use string manipulation to get what the name i needed. if no one has an easier way i can send you the code. it is in vb6 right now.
dan miel
sw 2008
stavros,
my book goes through exactly this and duplicates the entire feature tree from solidworks to a tree-view control in c#/vb.net.
you can use component2.getmodeldoc and then either modeldoc2.gettitle or modeldoc2.getpathname
wayne matus
texas engineering systems
thanks for the responses guys,
i want the name to save it in a custom property so that i can on a later stage retrieve it.
wayne the problem with using the functions you have suggested is that they retrieve the file name which is not necessarily the same with the component name displayed in the feature manager tree.
--stav.
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
edited: 05/19/2008 at 04:15 am by stavros antoniou
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-24 09:46 , Processed in 0.035633 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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