将自定义外观应用于伪造查看器中的单个模型片段 [英] Apply custom appearance to individual model fragments in forge viewer
问题描述
在viewable中,模型有3个叶子节点,名字为Solid1",父节点名称为Tread",如何通过父节点搜索得到dbId?
遵循
In the viewable, the model has three leaf nodes that are named "Solid1" but have a parent name of "Tread", how do I search by parent name to get the dbId?
Following the answer from Default material for model in Forge Viewer I can see that we can set a color. Is it possible to instead apply a texture?
Thanks!
The Viewer has a search() function so you can search for any component based on its properties. You can then go up and down the instance tree to go from Thread to Solid1 or vice versa. See e.g. https://forge.autodesk.com/blog/selection-override
Yes, you can also use texture for materials. See e.g. https://github.com/Autodesk-Forge/library-javascript-viewer-extensions/blob/master/src/Autodesk.ADN.Viewing.Extension.Material/Autodesk.ADN.Viewing.Extension.Material.js#L273
That code is used in this sample https://forge-rcdb.autodesk.io/configurator?id=58c7ae474c6d400bfa5aaf37
Just enable the "Material" extension by clicking on it, then you will be able to assign textured materials to faces.
这篇关于将自定义外观应用于伪造查看器中的单个模型片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!