![]() |
【转帖】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 |
所有的时间均为北京时间。 现在的时间是 08:05 PM. |