コード例 #1
0
        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;

            // Retrieve all linked-in IFC documents

            List <Document> ifcdocs
                = RoomZoneExporter.GetLinkedInIfcDocs(app);

            if (null == ifcdocs || 0 == ifcdocs.Count)
            {
                // If no IFC links are present, create one

                string path = JtSettings.Instance.IfcInputFilePath;

                if (CreateIfcLink(doc, path))
                {
                    ifcdocs = RoomZoneExporter
                              .GetLinkedInIfcDocs(app);
                }
            }

            int n = RoomZoneExporter.ExportAll(app);

            return((0 < n)
        ? Result.Succeeded
        : Result.Failed);
        }
コード例 #2
0
        /// <summary>
        /// Export all linked-in IFC document rooms and zones
        /// </summary>
        int ExportLinkedInIfcDocs(Application app)
        {
            if (0 == app.Documents.Size)
            {
                string path = JtSettings.Instance
                              .IfcRvtInputFilePath;

                Document doc = app.OpenDocumentFile(path);

                if (doc == null)
                {
                    string s = string.Format(
                        "Could not open document {0}.", path);

                    JtLogger.Log(s);

                    throw new InvalidOperationException(s);
                }
            }
            return(RoomZoneExporter.ExportAll(app));
        }