欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Revit API取得变量的内参名称实例代码

程序员文章站 2024-02-21 15:44:10
与取得元素变量的内参名称类别有个builtinparameter复制代码 代码如下://取得内参名称[transaction(transactionmode.manual)...

与取得元素变量的内参名称类别有个builtinparameter

复制代码 代码如下:

//取得内参名称
[transaction(transactionmode.manual)]
[regeneration(regenerationoption.manual)]
public class cmdgetbuiltinparam : iexternalcommand
{
    public result execute(externalcommanddata cmddata, ref string msg, elementset elements)
    {
        uidocument uidoc = cmddata.application.activeuidocument;
        document doc = uidoc.document;
        selection sel = uidoc.selection;

        duct duct = doc.getelement(sel.pickobject(objecttype.element, "选择")) as duct;
        foreach (parameter p in duct.parameters)
        {
            if (p.definition.name == "高度")
            {
                builtinparameter biparam = (builtinparameter)p.id.integervalue;
                taskdialog.show("builtin", biparam.tostring());
            }
        }

        return result.succeeded;
    }
}