直接形状导入材料怪癖,材料颜色通过API无效,直到通过UI编辑材料

时间:2017-06-28 17:23:47

标签: revit-api revitpythonshell

 - Testing in Revit 2017 
 - Dynamo Python node (/ revit lookup / any API call)

描述

我想查询材质的颜色属性。此材质是Rhino 3dm(DirectShape导入)自动生成的材质。 Color属性应该是图层颜色,这在查看材质浏览器及其呈现方式时也适用。但是,通过Revit API查询它会导致无效的颜色属性。

在您主动使用ui材质浏览器并修改材质之前,存储在直接形状的材质中的颜色参数未正确初始化/出错。在此之前,使用API​​(你可以使用revit lookup测试它)来获取材质颜色返回无效颜色,从而无法检索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.

视觉解释

可以在此处看到Visual PDF对问题的解释:https://www.docdroid.net/n2j9Auy/170628-color-direct-shape-material-quirk.pdf.html

1 个答案:

答案 0 :(得分:0)

您可能也想在官方Dynamo forum中提出同样的问题,因为Autodesk Dynamo的工作人员会与Revit开发团队保持密切联系,以便对此进行积极监控:

https://forum.dynamobim.com/