• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ElementSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ElementSet的典型用法代码示例。如果您正苦于以下问题:C# ElementSet类的具体用法?C# ElementSet怎么用?C# ElementSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ElementSet类属于命名空间,在下文中一共展示了ElementSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Execute

        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
              UIDocument uidoc = uiapp.ActiveUIDocument;

              //PickPointsForArea( uidoc );

              XYZ point_in_3d;

              if( PickFaceSetWorkPlaneAndPickPoint(
            uidoc, out point_in_3d ) )
              {
            TaskDialog.Show( "3D Point Selected",
              "3D point picked on the plane"
              + " defined by the selected face: "
              + Util.PointString( point_in_3d ) );

            return Result.Succeeded;
              }
              else
              {
            message = "3D point selection cancelled or failed";
            return Result.Failed;
              }
        }
开发者ID:nbright,项目名称:the_building_coder_samples,代码行数:28,代码来源:CmdPickPoint3d.cs


示例2: Execute

   public Result Execute(
 ExternalCommandData commandData,
 ref string message,
 ElementSet elements )
   {
       return Result.Succeeded;
   }
开发者ID:vchekalin,项目名称:test,代码行数:7,代码来源:Command.cs


示例3: GetAllSheets

        GetAllSheets (Document doc)
        {
            ElementSet allSheets = new ElementSet();
            FilteredElementCollector fec = new FilteredElementCollector(doc);
            ElementClassFilter elementsAreWanted = new ElementClassFilter(typeof(ViewSheet));
            fec.WherePasses(elementsAreWanted);
            List<Element> elements = fec.ToElements() as List<Element>;

            foreach (Element element in elements)
            {
               ViewSheet viewSheet = element as ViewSheet;

               if (null == viewSheet)
               {
                  continue;
               }
               else
               {
                  ElementId objId = viewSheet.GetTypeId();
                  if (ElementId.InvalidElementId == objId)
                  {
                     continue;
                  }
                  else
                  {
                     allSheets.Insert(viewSheet);
                  }
               }
            }

            return allSheets;
        }
开发者ID:15921050052,项目名称:RevitLookup,代码行数:32,代码来源:View.cs


示例4: Execute

        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            // Get application and document objects
            UIApplication uiApp = commandData.Application;
            Document doc = uiApp.ActiveUIDocument.Document;
            UIDocument uidoc = uiApp.ActiveUIDocument;

            try
            {
                if (!doc.IsWorkshared)
                {
                    TaskDialog.Show("Workset 3D View", "Project doesn't have any Worksets.");
                }
                else
                {
                    ViewFamilyType vft = new FilteredElementCollector(doc)
                    .OfClass(typeof(ViewFamilyType))
                    .Cast<ViewFamilyType>()
                    .FirstOrDefault(q => q.ViewFamily == ViewFamily.ThreeDimensional);

                    using (Transaction t = new Transaction(doc, "Workset View Creation"))
                    {
                        t.Start();
                        int i = 0;
                        // Loop through all User Worksets only
                        foreach (Workset wst in new FilteredWorksetCollector(doc)
                            .WherePasses(new WorksetKindFilter(WorksetKind.UserWorkset)))
                        {
                            // Create a 3D View
                            View3D view = View3D.CreateIsometric(doc, vft.Id);

                            // Set the name of the view to match workset
                            view.Name = "WORKSET - " + wst.Name;

                            // Isolate elements in the view using a filter to find elements only in this workset
                            view.IsolateElementsTemporary(new FilteredElementCollector(doc)
                                .WherePasses(new ElementWorksetFilter(wst.Id))
                                .Select(q => q.Id)
                                .ToList());
                            i++;
                        }
                        t.Commit();
                        TaskDialog.Show("Workset 3D View", i.ToString() + " Views Created Successfully!");
                    }
                }
                return Result.Succeeded;
            }
            catch (Autodesk.Revit.Exceptions.OperationCanceledException)
            {
                return Result.Cancelled;
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return Result.Failed;
            }
        }
开发者ID:mjkkirschner,项目名称:GrimshawTools,代码行数:60,代码来源:Workset3dView.cs


示例5: Execute

        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication app = commandData.Application;
              UIDocument uidoc = app.ActiveUIDocument;
              Document doc = uidoc.Document;

              Selection sel = uidoc.Selection;
              string msg = string.Empty;

              foreach( Element e in sel.Elements )
              {
            Wall wall = e as Wall;
            if( null != wall )
            {
              msg += ProcessWall( wall );
            }
              }
              if( 0 == msg.Length )
              {
            msg = "Please select some walls.";
              }
              Util.InfoMsg( msg );
              return Result.Succeeded;
        }
开发者ID:JesseMom,项目名称:the_building_coder_samples,代码行数:27,代码来源:CmdWallDimensions.cs


示例6: Execute

        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
              UIDocument uidoc = uiapp.ActiveUIDocument;
              Application app = uiapp.Application;
              Document doc = uidoc.Document;

              Transaction tx = new Transaction( doc,
            "Extract Part Atom" );

              tx.Start();

              string familyFilePath
            = "C:/Documents and Settings/All Users"
            + "/Application Data/Autodesk/RAC 2011"
            + "/Metric Library/Doors/M_Double-Flush.rfa";

              string xmlPath = "C:/tmp/ExtractPartAtom.xml";

              app.ExtractPartAtomFromFamilyFile(
            familyFilePath, xmlPath );

              tx.Commit();

              return Result.Succeeded;
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:29,代码来源:CmdPartAtom.cs


示例7: Execute

 public Result Execute( Autodesk.Revit.UI.ExternalCommandData cmdData, ref string msg, ElementSet elems )
 {
   TaskDialog helloDlg = new TaskDialog( "Autodesk Revit" );
   helloDlg.MainContent = "Hello World from " + System.Reflection.Assembly.GetExecutingAssembly().Location;
   helloDlg.Show();
   return Result.Cancelled;
 }
开发者ID:15921050052,项目名称:RevitLookup,代码行数:7,代码来源:TestCmds.cs


示例8: Execute

        public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,
                                               ref string message,
                                               ElementSet elements)
        {
            if (null == commandData.Application.ActiveUIDocument.Document)
            {
                message = "Active document is null.";
                return Result.Failed;
            }

            try
            {
                var creator = new FamilyInstanceCreator(commandData.Application);

                var importer = new PSDataImporter(creator);

                importer.StartImport();

                return Autodesk.Revit.UI.Result.Succeeded;
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return Autodesk.Revit.UI.Result.Failed;
            }
        }
开发者ID:KonbOgonb,项目名称:revit-psElectro-bridge,代码行数:26,代码来源:ImportFromPs.cs


示例9: Execute

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                // Find all of the runs and organize them
                doc = commandData.Application.ActiveUIDocument.Document;
                allRuns = FindExisting();
                
                if (allRuns != null && allRuns.Count > 0)
                {
                    RevitServerApp._app.ShowSelectionForm(allRuns, commandData.Application.ActiveUIDocument);
                }
                else
                {
                    TaskDialog.Show("Message", "No existing run elements found.");
                }

                return Result.Succeeded;
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error", ex.Message);
                return Result.Failed;
            }
        }
开发者ID:ramonvanderheijden,项目名称:Lyrebird,代码行数:25,代码来源:SelectRunElementsCmd.cs


示例10: Execute

        /// <summary>
        /// Command Entry Point
        /// </summary>
        /// <param name="commandData">Input argument providing access to the Revit application and documents</param>
        /// <param name="message">Return message to the user in case of error or cancel</param>
        /// <param name="elements">Return argument to highlight elements on the graphics screen if Result is not Succeeded.</param>
        /// <returns>Cancelled, Failed or Succeeded</returns>
        public Result Execute(ExternalCommandData commandData,
                            ref string message,
                            ElementSet elements)
        {
            try
              {

            // Version
            if (!commandData.Application.Application.VersionName.Contains("2013"))
            {
              message = "This Add-In was built for Revit 2013, please contact CASE for assistance...";
              return Result.Failed;
            }

            // Construct and Display the form
            form_Main frm = new form_Main(commandData);
            frm.ShowDialog();

            // Return Success
            return Result.Succeeded;
              }
              catch (Exception ex)
              {

            // Failure Message
            message = ex.Message;
            return Result.Failed;

              }
        }
开发者ID:WeConnect,项目名称:case-apps,代码行数:37,代码来源:cmd.cs


示例11: Execute

        public Result Execute(
            ExternalCommandData revit,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = revit.Application;
              UIDocument uidoc = uiapp.ActiveUIDocument;
              Document doc = uidoc.Document;

              string path = doc.PathName;

              BasicFileInfo info = BasicFileInfo.Extract(
            path );

              DocumentVersion v = info.GetDocumentVersion();

              int n = v.NumberOfSaves;

              Util.InfoMsg( string.Format(
            "Document '{0}' has GUID {1} and {2} save{3}.",
            path, v.VersionGUID, n,
            Util.PluralSuffix( n ) ) );

              return Result.Succeeded;
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:25,代码来源:CmdDocumentVersion.cs


示例12: Execute

 /// <summary>
 /// Implement this method as an external command for Revit.
 /// </summary>
 /// <param name="commandData">An object that is passed to the external application 
 /// which contains data related to the command, 
 /// such as the application object and active view.</param>
 /// <param name="message">A message that can be set by the external application 
 /// which will be displayed if a failure or cancellation is returned by 
 /// the external command.</param>
 /// <param name="elements">A set of elements to which the external application 
 /// can add elements that are to be highlighted in case of failure or cancellation.</param>
 /// <returns>Return the status of the external command. 
 /// A result of Succeeded means that the API external method functioned as expected. 
 /// Cancelled can be used to signify that the user cancelled the external operation 
 /// at some point. Failure should be returned if the application is unable to proceed with 
 /// the operation.</returns>
 public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,
                                        ref string message,
                                        ElementSet elements)
 {
     try
     {
         Transaction documentTransaction = new Transaction(commandData.Application.ActiveUIDocument.Document, "Document");
         documentTransaction.Start();
         using (SpotDimensionInfoDlg infoForm = new SpotDimensionInfoDlg(commandData))
         {
             //Highlight the selected spotdimension
             if (infoForm.ShowDialog() == System.Windows.Forms.DialogResult.OK
                 && infoForm.SelectedSpotDimension != null)
             {
                 elements.Insert(infoForm.SelectedSpotDimension);
                 message = "High light the selected SpotDimension";
                 return Autodesk.Revit.UI.Result.Failed;
             }
         }
         documentTransaction.Commit();
         return Autodesk.Revit.UI.Result.Succeeded;
     }
     catch (Exception ex)
     {
        // If there are something wrong, give error information and return failed
        message = ex.Message;
        return Autodesk.Revit.UI.Result.Failed;
     }
 }
开发者ID:AMEE,项目名称:revit,代码行数:45,代码来源:Command.cs


示例13: beginCommand

        public static void beginCommand(Document doc, string strDomain, bool bForAllSystems = false, bool bFitlerUnCalculationSystems = false)
        {
            PressureLossReportHelper helper = PressureLossReportHelper.instance;
             UIDocument uiDocument = new UIDocument(doc);
             if (bFitlerUnCalculationSystems)
             {
            ElementSet calculationOnElems = new ElementSet();
            int nTotalCount = getCalculationElemSet(doc, strDomain, calculationOnElems, uiDocument.Selection.Elements);

            if (calculationOnElems.Size == 0)
            {//No item can be calculated
               popupWarning(ReportResource.allItemsCaculationOff, TaskDialogCommonButtons.Close, TaskDialogResult.Close);
               return;
            }
            else if (calculationOnElems.Size < nTotalCount)
            {//Part of them can be calculated
               if (popupWarning(ReportResource.partOfItemsCaculationOff, TaskDialogCommonButtons.No | TaskDialogCommonButtons.Yes, TaskDialogResult.Yes) == TaskDialogResult.No)
                  return;
            }

            helper.initialize(doc, calculationOnElems, strDomain);
            invokeCommand(doc, helper, bForAllSystems);
             }
             else
             {
            helper.initialize(doc, uiDocument.Selection.Elements, strDomain);
            invokeCommand(doc, helper, bForAllSystems);
             }
        }
开发者ID:jeremytammik,项目名称:UserMepCalculation,代码行数:29,代码来源:PressureLossReportEntry.cs


示例14: Execute

        public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
        {
            Setup(cmdData);

            var exe = new RevitTestExecutive();
            return exe.Execute(cmdData, ref message, elements);
        }
开发者ID:Randy-Ma,项目名称:RevitTestFramework,代码行数:7,代码来源:RevitTestFramework.cs


示例15: Execute

        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            Document doc = commandData.Application
            .ActiveUIDocument.Document;

              FilteredElementCollector collector
            = new FilteredElementCollector( doc );

              collector.OfClass( typeof( Level ) );
              Level level = collector.FirstElement() as Level;

              Transaction t = new Transaction( doc );

              t.Start( "Create unbounded room" );

              FailureHandlingOptions failOpt
            = t.GetFailureHandlingOptions();

              failOpt.SetFailuresPreprocessor(
            new RoomWarningSwallower() );

              t.SetFailureHandlingOptions( failOpt );

              doc.Create.NewRoom( level, new UV( 0, 0 ) );

              t.Commit();

              return Result.Succeeded;
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:32,代码来源:CmdPreprocessFailure.cs


示例16: Execute

        /// <summary>
        /// Overload this method to implement and external command within Revit.
        /// </summary>
        /// <returns>
        /// The result indicates if the execution fails, succeeds, or was canceled by user. If it does not
        /// succeed, Revit will undo any changes made by the external command. 
        /// </returns>
        /// <param name="commandData">An ExternalCommandData object which contains reference to Application and View
        /// needed by external command.</param><param name="message">Error message can be returned by external command. This will be displayed only if the command status
        /// was "Failed".  There is a limit of 1023 characters for this message; strings longer than this will be truncated.</param><param name="elements">Element set indicating problem elements to display in the failure dialog.  This will be used
        /// only if the command status was "Failed".</param>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            // FIXME: somehow fetch back message after script execution...
            var executor = new ScriptExecutor(commandData, message, elements);

            string source;
            using (var reader = File.OpenText(_scriptSource))
            {
                source = reader.ReadToEnd();
            }

            var result = executor.ExecuteScript(source);
            message = executor.Message;
            switch (result)
            {
                case (int)Result.Succeeded:
                    return Result.Succeeded;
                case (int)Result.Cancelled:
                    return Result.Cancelled;
                case (int)Result.Failed:
                    return Result.Failed;
                default:
                    return Result.Succeeded;
            }
        }
开发者ID:pterelaos,项目名称:revitpythonshell,代码行数:36,代码来源:CommandLoaderBase.cs


示例17: Execute

        public Result Execute(
            ExternalCommandData commandData,
            ref String message,
            ElementSet elements)
        {
            UIApplication app = commandData.Application;
              Document doc = app.ActiveUIDocument.Document;

              ViewSheet currentSheet
            = doc.ActiveView as ViewSheet;

              //foreach( View v in currentSheet.Views ) // 2014 warning	'Autodesk.Revit.DB.ViewSheet.Views' is obsolete.  Use GetAllPlacedViews() instead.

              foreach( ElementId id in currentSheet.GetAllPlacedViews() ) // 2015
              {
            View v = doc.GetElement( id ) as View;

            // the values returned here do not seem to
            // accurately reflect the positions of the
            // views on the sheet:

            BoundingBoxUV loc = v.Outline;

            Debug.Print(
              "Coordinates of {0} view '{1}': {2}",
              v.ViewType, v.Name,
              Util.PointString( loc.Min ) );
              }

              return Result.Failed;
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:31,代码来源:CmdCoordsOfViewOnSheet.cs


示例18: Execute

        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                                             ref string message,
                                             ElementSet elements)
        {
            m_app = commandData.Application.Application;
             MessageManager.MessageBuff = new StringBuilder();

             try
             {
            bool succeeded = LoadFamiliesAndAddParameters();

            if (succeeded)
            {
               return Autodesk.Revit.UI.Result.Succeeded;
            }
            else
            {
               message = MessageManager.MessageBuff.ToString();
               return Autodesk.Revit.UI.Result.Failed;
            }
             }
             catch (Exception e)
             {
            message = e.Message;
            return Autodesk.Revit.UI.Result.Failed;
             }
        }
开发者ID:AMEE,项目名称:revit,代码行数:43,代码来源:Command.cs


示例19: Execute

        public IExternalCommand.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            SelElementSet selSet = commandData.Application.ActiveDocument.Selection.Elements;
            if (selSet.Size != 1)
            {
                return IExternalCommand.Result.Cancelled;
            }
            ElementSetIterator it = selSet.ForwardIterator();
            if (it.MoveNext())
            {
                Room room = it.Current as Room;
                if (room != null)
                {
                    ParameterSetIterator paraIt = room.Parameters.ForwardIterator();
                    while (paraIt.MoveNext())
                    {
                        Parameter para = paraIt.Current as Parameter;
                        if (para == null) continue;
                        if (para.Definition.Name.Equals("名称"))
                        {
                            para.Set("My Room");
                            break;
                        }
                    }
                }
            }

            return IExternalCommand.Result.Succeeded;
        }
开发者ID:guchanghai,项目名称:Cut,代码行数:29,代码来源:SetRoomNameParam.cs


示例20: Execute

        /// <summary>
        /// Command Entry Point
        /// </summary>
        /// <param name="commandData">Input argument providing access to the Revit application and documents</param>
        /// <param name="message">Return message to the user in case of error or cancel</param>
        /// <param name="elements">Return argument to highlight elements on the graphics screen if Result is not Succeeded.</param>
        /// <returns>Cancelled, Failed or Succeeded</returns>
        public Result Execute(ExternalCommandData commandData,
                            ref string message,
                            ElementSet elements)
        {
            m_app = commandData.Application;

              try
              {
            bool succeeded = AddParameters();

            if (succeeded)
            {
              MessageBox.Show("Done. Binding Shared Parameters Succeeded.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
              return Autodesk.Revit.UI.Result.Succeeded;
            }
            else
            {
              MessageBox.Show("Failed", "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
              return Autodesk.Revit.UI.Result.Failed;
            }
              }
              catch (Exception ex)
              {
            // Failure Message
            message = ex.Message;
            return Result.Failed;
              }
        }
开发者ID:alnjxn,项目名称:bim-source,代码行数:35,代码来源:Commands.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ElementState类代码示例发布时间:2022-05-24
下一篇:
C# ElementRequest类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap