[Closed] About getArea method
obj = $
setCommandPanelTaskMode mode:#modify
addmodifier obj (unwrap_UVW())
obj.modifiers[#unwrap_uvw].unwrap.setmapchannel 2
dialogMonitorOps.interactive = false
obj.modifiers[#unwrap_uvw].unwrap.reset()
a = polyop.getnumfaces obj
obj.modifiers[#unwrap_uvw].unwrap4.getArea #{1..a} &myValX &myValY &myValWidth &myValHeight &myValAreaUVW &myFaceArea
print yValAreaUVW
areaUVWPercent = myValAreaUVW * 100
print areaUVWPercent
deletemodifier obj obj.modifiers[#unwrap_uvw]
dialogMonitorOps.enabled = false
I use this code chunk to calculate UVW occupy ratio of a model’s second UVW channel in comparison with [0,0][1,1] UVW coordinate area.On most models the result is correct,which is,if the UVW is well unwrapped,this percentage number will below 100,and above 0 of course.But for some models,whose second UVW channel’s UVW map looks just fine even though,the result is weirdly far above 100,as does this model attached in the zip file.Once I use 3ds Max’s embedded mapping tool or 3 third party unfold tool like unfold3D to reunwrap its UVW in the second channel,the result will become correct.Please someone who is familiar with the getArea method as well as UVW stuffs profile this model for me and tell me why does this happen.Thanks a lot!
tips:To make this code chunk work,you need to select the object first.
its because you uvs have “depth” in the W channel, if you add an unwrap and change the view mode to vw then flatten then and run your script i believe you will get the result you are looking for
Thank you broomy,you point to the right direction.
Now I add some lines to avoid the W factor’s affect on the calculation result and it looks right now.