- Testing in Revit 2017
- Dynamo Python node (/ revit lookup / any API call)
描述
我想查询材料的颜色属性。该材质是从 Rhino 3dm(DirectShape Import)自动生成的材质。Color 属性应该是图层颜色,这在查看材质浏览器及其渲染方式时适用。但是,通过 Revit API 查询它会导致颜色属性无效。
在您主动使用 ui 材质浏览器并修改材质之前,从直接形状存储在材质中的颜色参数不会正确初始化/出错。在此之前,使用 API(您可以使用 revit 查找测试)来获取材质颜色返回无效颜色,从而无法检索 rgb 值
但是通过 Ui 编辑材质,例如编辑表面图案或颜色...这会以某种方式刷新颜色参数,并允许之后使用 revit API 读取颜色参数。
到目前为止我尝试过的事情
+ Updating another property (such as surface pattern / color) via the API, doesn't do the same as when updating via the UI material browser
+ Doc.Regenerate() after updating the property. (No changes)
+ tried getting built in parameter'doc.GetElement(ElementId(28736714)).Parameter[BuiltInParameter.MATERIAL_PARAM_COLOR].AsValueString()' returns blank.
+ tried saving document after updating misc. property via api, doesn't change anything.
想法
+ reading the solids and faces , somehow translating them to brep geometry and recreating the direct shape. in this way one can assign the material IDs to each face. however, geometry faces as far as i know cannot be converted into brep builder faces.
视觉解释
可以在这里看到问题的可视化 PDF 解释:https ://www.docdroid.net/n2j9Auy/170628-color-direct-shape-material-quirk.pdf.html