【问题标题】:How to add instance / type paramter to Family Instance in revit api c#如何在 revit api c# 中将实例/类型参数添加到族实例
【发布时间】:2018-06-12 20:27:58
【问题描述】:

我正在做一个项目,我需要在身份数据下将自定义参数添加到墙壁和管件等元素

我能够将参数和值添加到墙壁,但对于管道配件,我能够添加参数,但在添加值时出现错误。

我的代码如下

ExternalDefinitionCreationOptions edco = null;
edco = new ExternalDefinitionCreationOptions(param, ParameterType.Text);
edco.Visible = true;
var definition = uiApp.Application.OpenSharedParameterFile().Groups.Create("Custom Parameters").Definitions.Create(edco);
uiApp.Application.SharedParametersFilename = originalFile;
var newCategorySet = uiApp.Application.Create.NewCategorySet();
newCategorySet.Insert(doc.Settings.Categories.get_Item(builtInCategory));
binding = uiApp.Application.Create.NewTypeBinding(newCategorySet);
doc.ParameterBindings.Insert(definition, binding, builtinGroup);
if (!double.IsNaN((double)value))
    ele.LookupParameter(param).Set((double)value);//here I get an error 
    //since ele.LookupParameter(param) returned null for pipe fitting

是不是因为管件是FamilyInstance

是否有其他方法可以将自定义属性添加到家庭实例

请指导我

谢谢

【问题讨论】:

    标签: c# revit-api


    【解决方案1】:

    也许您需要提交事务,因此在开始填充并添加值之前,共享参数确实被添加并绑定到类别,参见。 need to regenerate

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-29
      • 2022-09-27
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多