几何尺寸与公差论坛

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

【转帖】getting all the colors of components and parts

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

本版积分规则

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

GMT+8, 2024-12-23 23:09 , Processed in 0.034620 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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