在讲autodesk Revit模型文件转换为VRML(.wrl)过程中发现,材质丢失了。因为导出为wrl的材质是不能识别autodesk的材质。所以只能将autodesk材质转换为标准材质。
手动修改吧太复杂了,所以重新写了一个转换函数。将所有材质,包括多维子材质转换为标准材质。问题解决。
fn converMat obj =(
colorSrc=color 200 200 200
try(
colorSrc=obj.Material.Generic_Color
)
catch()
try(
colorSrc=obj.Material.Concrete_Color
)
catch()
try(
colorSrc=obj.Material.Wall_Paint_Color
)
catch()
try(
colorSrc=obj.Material.Ceramic_Color
)
catch()
try(
colorSrc=obj.Material.diff_color
)
catch()
try(
colorSrc=obj.Material.Masonry_Color
)
catch()
try(
colorSrc=obj.Material.Metallic_Paint_Color
)
catch()
print colorSrc
obj.Material=Standardmaterial ()
obj.Material.Ambient =colorSrc
obj.Material.Diffuse = colorSrc
)
for obj in selection do
(
print obj.material
if (obj.Material != undefined and Classof obj.Material == StandardMaterial)then
(
)
else if(obj.Material != undefined and Classof obj.Material == MultiMaterial)then
(
num=1
for subMat in obj.Material do(
if(Classof subMat==Autodesk_Material) then (
colorSrc=color 200 200 200
try(
colorSrc=subMat.Generic_Color
)
catch()
try(
colorSrc=subMat.Concrete_Color
)
catch()
try(
colorSrc=subMat.Wall_Paint_Color
)
catch()
try(
colorSrc=subMat.Ceramic_Color
)
catch()
try(
colorSrc=subMat.diff_color
)
catch()
try(
colorSrc=subMat.Masonry_Color
)
catch()
try(
colorSrc=subMat.Metallic_Paint_Color
)
catch()
print colorSrc
obj.Material[num]=Standardmaterial ()
obj.Material[num].Ambient =colorSrc
obj.Material[num].Diffuse = colorSrc
)
num=num+1
)
)
else if(obj.Material != undefined and Classof obj.Material==Autodesk_Material)then
(
converMat(obj)
)
)
本文介绍了解决AutodeskRevit模型文件转换为VRML(.wrl)过程中材质丢失的问题。通过编写转换函数,将所有材质,包括多维子材质,统一转换为标准材质,确保材质信息不丢失。

4734

被折叠的 条评论
为什么被折叠?



