简体   繁体   English

Autodesk Forge Viewer:将片段材质连接到 Revit 模型数据

[英]Autodesk Forge Viewer: Connect Fragment Material to Revit Model Data

EDIT: TLDR there is currently no way to know material names on the fragment level.编辑:TLDR 目前无法知道片段级别的材料名称。

I want to read the materials from fragments of a node and change their materials according to a map that uses the Revit material names as keys.我想从节点的片段中读取材质,并根据使用 Revit 材质名称作为键的贴图更改它们的材质。

I have the following "Materials and Finishes" properties from a node in the model (retrieved via Viewer3D):我从模型中的节点(通过 Viewer3D 检索)具有以下“材料和饰面”属性: 来自“材料和饰面”的节点数据

And I have the following THREE materials from the fragments of that node:我从该节点的片段中获得了以下三种材料: 来自节点片段的三种js材料

Is there a way to set the names of the THREE materials to match the model data (or use them at all)?有没有办法设置三种材料的名称以匹配模型数据(或完全使用它们)?

Ideally I would be able to match these THREE materials with the following materials extracted from this node:理想情况下,我可以将这三种材料与从此节点中提取的以下材料相匹配: 材料数据

The SVF file format (generated by the Model Derivative service and loaded by Forge Viewer) does not preserve material names unfortunately.不幸的是,SVF 文件格式(由模型衍生服务生成并由 Forge Viewer 加载)不保留材料名称。 The fragments are simply associated with a specific material based on its index in the list.片段只是根据其在列表中的索引与特定材料相关联。

The "Materials and Finishes" data is basically just a property specific to the original file (in this case a Revit model), and it may not be available in other file formats. “材料和饰面”数据基本上只是原始文件(在本例中为 Revit 模型)的特定属性,在其他文件格式中可能不可用。

EDIT: I tried looking into the Materials.json.gz file, and unfortunately the names are not included there, either:编辑:我尝试查看Materials.json.gz文件,但不幸的是,其中也不包含名称:

{
    "name": "LMVTK Simple Materials",
    "version":  "1.0",
    "scene":    {
        "SceneUnit":    8215,
        "YIsUp":    0
    },
    "materials":    {
        "0":    {
            "version":  2,
            "userassets":   ["0"],
            "materials":    {
                "0":    {
                    "tag":  "",
                    "proteinType":  "",
                    "definition":   "SimplePhong",
                    "properties":   {
                        "integers": {
                            "mode": 4
                        },
                        "booleans": {
                            "color_by_object":  false,
                            "generic_is_metal": false,
                            "generic_backface_cull":    true
                        },
                        "scalars":  {
                            "generic_transparency": {
                                "units":    "",
                                "values":   [0]
                            }
                        },
                        "colors":   {
                            "generic_diffuse":  {
                                "values":   [{
                                        "r":    0,
                                        "g":    1,
                                        "b":    0,
                                        "a":    1
                                    }]
                            }
                        }
                    },
                    "transparent":  false,
                    "textures": {
                }
                }
            }
        },
        "1":    {
            "version":  2,
            "userassets":   ["0"],
            "materials":    {
                "0":    {
                    "tag":  "",
                    "proteinType":  "",
                    "definition":   "SimplePhong",
                    "properties":   {
                        "integers": {
                            "mode": 4
                        },
                        "booleans": {
                            "color_by_object":  false,
                            "generic_is_metal": false,
                            "generic_backface_cull":    true
                        },
                        "scalars":  {
                            "generic_transparency": {
                                "units":    "",
                                "values":   [0]
                            }
                        },
                        "colors":   {
                            "generic_diffuse":  {
                                "values":   [{
                                        "r":    0.400000,
                                        "g":    0.400000,
                                        "b":    0.400000,
                                        "a":    1
                                    }]
                            }
                        }
                    },
                    "transparent":  false,
                    "textures": {
                }
                }
            }
        }
...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM