当前位置: 首页>>代码示例>>C#>>正文


C# Element.GetParameters方法代码示例

本文整理汇总了C#中Element.GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# Element.GetParameters方法的具体用法?C# Element.GetParameters怎么用?C# Element.GetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Element的用法示例。


在下文中一共展示了Element.GetParameters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            if (commandData == null || commandData.Application == null || commandData.Application.ActiveUIDocument == null)
            {
                TaskDialog.Show("Revit", "Comment Editor requires an open document.");
                return Result.Failed;
            }

            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Access current selection

            Selection sel = uidoc.Selection;

            if (sel.GetElementIds().Count != 1)
            {
                TaskDialog.Show("Revit", "Comment Editor requires a single element selected.");
                return Result.Failed;
            }

            m_element = doc.GetElement(sel.GetElementIds().FirstOrDefault());
            Parameter comment = m_element.GetParameters("Comments").FirstOrDefault();

            if (comment == null)
            {
                TaskDialog.Show("Revit", "Comment Editor requires the selected element to have a comment parameter");
                return Result.Failed;
            }

            CommentEditorDialog ced = new CommentEditorDialog();
            Window cew = new Window();
            cew.Content = ced;
            cew.Title = "Comment Editor";
            cew.Width = ced.grid.Width;
            cew.Height = ced.grid.Height;
            ced.Text = comment.AsString();
            cew.ResizeMode = ResizeMode.NoResize;
            cew.ShowDialog();

            if (cew.DialogResult.Value == false)
            {
                return Result.Cancelled;
            }

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Edit Element Comment");
                comment.Set(ced.Text);
                tx.Commit();
            }

            return Result.Succeeded;
        }
开发者ID:curlymorphic,项目名称:RevitCommentEditor,代码行数:59,代码来源:Command.cs

示例2: GetDefinition

        /// <summary>
        /// Return the parameter definition from
        /// the given element and parameter name.
        /// </summary>
        static Definition GetDefinition(
            Element e,
            string parameter_name)
        {
            //Parameter p = e.get_Parameter( parameter_name ); // 2014

              IList<Parameter> ps = e.GetParameters( parameter_name );

              int n = ps.Count;

              Debug.Assert( 1 >= n,
            "expected maximum one shared parameters "
            + "named " + parameter_name );

              Definition d = ( 0 == n )
            ? null
            : ps[0].Definition;

              return d;
        }
开发者ID:jeremytammik,项目名称:ExportCncFab,代码行数:24,代码来源:ExportParameters.cs

示例3: GetAddedParameter

        // This function should only be necessary while using ExperimentalAddParameter.
        private static Parameter GetAddedParameter(Element element, string parameterName, StorageType type)
        {
            IList<Parameter> parameterList = element.GetParameters(parameterName);

            if (parameterList == null) 
                return null;

            foreach (Parameter parameter in parameterList)
            {
                if (parameter.StorageType != type)
                    continue;

                if (parameter.IsReadOnly)
                    continue;

                Definition paramDefinition = parameter.Definition;
                if (paramDefinition == null)
                    continue;

                if (paramDefinition.ParameterGroup == BuiltInParameterGroup.PG_IFC)
                    return parameter;
            }

            // Shouldn't get here.
            return null;
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:27,代码来源:IFCPropertySet.cs

示例4: GetDefinition

        /// <summary>
        /// Return the parameter definition from
        /// the given element and parameter name.
        /// </summary>
        public static Definition GetDefinition( Element e )
        {
            IList<Parameter> ps = e.GetParameters(
            _shared_param_name );

              int n = ps.Count;

              Debug.Assert( 1 >= n,
            "expected maximum one shared parameters "
            + "named " + _shared_param_name );

              Definition d = ( 0 == n )
            ? null
            : ps[0].Definition;

              return d;
        }
开发者ID:ChengZY,项目名称:TraverseAllSystems,代码行数:21,代码来源:SharedParameterMgr.cs


注:本文中的Element.GetParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。