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


C# ElementSet类代码示例

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


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


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