查看单个帖子
旧 2009-04-13, 11:04 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】getting all the colors of components and parts

getting all the colors of components and parts
how do i get all the colors of a component or a part? i tried getmaterialpropertyvalues function but it is not working.
please help. thanks in advance
sw 2007 office premium sp1.0
hi,
try this macro:
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swbody as sldworks.body2
dim vbodyarr as variant
dim vbody as variant
dim vmatprop as variant
dim i as long
sub main()
set swapp = application.sldworks
set swmodel = swapp.activedoc
for i = 0 to 5
vbodyarr = swmodel.getbodies2(i, false)
if not isempty(vbodyarr) then
for each vbody in vbodyarr
set swbody = vbody
vmatprop = swbody.materialpropertyvalues2
if not isempty(vmatprop) then
msgbox ("rgb = [" & vmatprop(0) * 255# & ", " & vmatprop(1) * 255# & ", " & vmatprop(2) * 255# & "]")
end if
next
end if
next i
end sub
thanks,
artem
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)