Esempio n. 1
0
        // Z:\SEA\Projects\00018.zlab\Design Computation\Development\2019\Project Health Dashboard
        // https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/

        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Result returnResult = Result.Succeeded;

            try
            {
                Document doc = commandData.Application.ActiveUIDocument.Document;

                ElementPropertiesWrapper propsWrapper = new ElementPropertiesWrapper(doc);

                FileInfo rvtPath;
                // What if it's a Cloud model?

                string FilePath;

                if (doc.IsModelInCloud)
                {
                    FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), doc.Title);
                }
                else
                {
                    rvtPath  = new FileInfo(doc.PathName);
                    FilePath = Path.Combine(
                        rvtPath.DirectoryName,
                        Path.GetFileNameWithoutExtension(rvtPath.FullName));
                }

                // Write to TEXT:
                //propsWrapper.WriteToTabDelimitedText(FilePath + ".tab");

                // Write to JSON:
                propsWrapper.WriteToJson(FilePath + ".json");
            }
            catch (Exception ex)
            {
                message      = "ZGF Add-in HarvestProjectData encountered an exception.\nException details:\n\n" + ex.Message;
                returnResult = Result.Failed;
            }

            return(returnResult);
        }
Esempio n. 2
0
        // Z:\SEA\Projects\00018.zlab\Design Computation\Development\2019\Project Health Dashboard
        // https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/

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

            ElementPropertiesWrapper propsWrapper = new ElementPropertiesWrapper(doc);

            FileInfo rvtPath = new FileInfo(doc.PathName);
            // What if it's a Cloud model?
            string FilePath = Path.Combine(
                rvtPath.DirectoryName,
                Path.GetFileNameWithoutExtension(rvtPath.FullName));

            // Write to TEXT:

            //propsWrapper.WriteToTabDelimitedText(FilePath + ".tab");

            // Write to JSON:
            propsWrapper.WriteToJson(FilePath + ".json");



            return(Result.Succeeded);
        }