【问题标题】:Revit Family type parameter readingRevit Family 类型参数读取
【发布时间】:2015-05-05 17:04:11
【问题描述】:

我无法使用 vb.net 读取所选元素的所有参数。我需要阅读所有参数,包括类型参数。 我的代码如下。

Dim picked As Reference = uiapp.ActiveUIDocument.Selection.PickObject(UI.Selection.ObjectType.Element)
Dim ele As Element = uiapp.ActiveUIDocument.Document.GetElement(picked.ElementId)
Dim idasstring As String = picked.ElementId.ToString()

For Each p As Parameter In ele.Parameters
     count = count + 1

     frmFriDB.lstParameter.Items.Add(" Parameter Name : " + p.Definition.Name.ToString() +
               vbCrLf + "   Value: " + vbCrLf + p.AsString() + p.AsValueString())
Next

【问题讨论】:

    标签: revit revit-api


    【解决方案1】:

    如果参数是字符串参数,则只能使用 p.AsString()。您可以使用 Parameter.StorageType 属性进行检查。

    此页面应该为您提供更多信息:http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-D003803E-9FA0-4B2B-AB62-7DCC3A503644

    要获取类型参数,需要获取代表该类型的元素:

    Dim typeEle as Element = uiapp.ActiveUIDocument.Document.GetElement(ele.GetTypeId())
    

    从那里,以与从元素中检索参数相同的方式从 type 元素中检索参数。

    我建议在继续之前花一些时间阅读帮助文档。

    最后一点,您可以直接从引用中检索元素,因此行

    Dim ele As Element = uiapp.ActiveUIDocument.Document.GetElement(picked.ElementId)
    

    可以替换为

    Dim ele As Element = uiapp.ActiveUIDocument.Document.GetElement(picked)
    

    【讨论】:

      猜你喜欢
      • 2018-06-24
      • 2021-02-21
      • 2020-10-15
      • 2021-02-19
      • 2012-07-10
      • 2021-09-25
      • 2017-07-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多