Example #1
0
        public static void GetLocation(Document document, cls_Image_Data tbdDataSet)
        {
            // Get the SiteLocation instance.
            SiteLocation site = document.SiteLocation;

            // Angles are in radians when coming from Revit API, so we
            // convert to degrees for display
            const double angleRatio = Math.PI / 180;   // angle conversion factor

            // Format the prompt information of basepoint.
            String prompt = "Current project's Site location information:";

            prompt += "\n\t" + "Latitude: " + site.Latitude / angleRatio + "XX";
            prompt += "\n\t" + "Longitude: " + site.Longitude / angleRatio + "YY";
            prompt += "\n\t" + "TimeZone: " + site.TimeZone;

            // Format the prompt information of basepoint offset
            double x = tbdDataSet.Latitude - site.Latitude / angleRatio;
            double y = tbdDataSet.Longidude - site.Longitude / angleRatio * -1;

            //define offset values
            offset = new XYZ(x, y, 0);

            //Format the prompt for the offset distance from basepoint
            prompt += "\n\t" + offset.X + "\n\t" + offset.Y;

            // Give the user some information.
            Debug.Print("Revit", prompt);
        }
Example #2
0
        /// <summary>
        /// Get the data from Flux
        /// </summary>
        /// <param name="projectName"></param>
        public void GetDataFromFlux(string projectName)
        {
            // get list of flux projects
            FluxProjects = SDK.CurrentUser.Projects;                        // get list of projects

            var tempNames = from project in FluxProjects
                            where !string.IsNullOrEmpty(project.Name)
                            select project.Name;                            // get project names

            ProjectNames = tempNames.ToList();

            // get flux project
            int index = ProjectNames.FindIndex(x => x == projectName);      // find the project index

            FluxProject = FluxProjects[index];                              // get the Flux Project

            // get list of data keys
            FluxDataKeys = FluxProject.DataTable.Cells;                     // get data keys

            // get data key
            Cell cell = FluxProject.DataTable.GetCell(FluxDataKeys[0].CellId);              // get the cell

            // get data from flux
            CellValue value      = cell.Value;
            string    tempString = Flux.Serialization.DataSerializer.Serialize(imgData);

            string CellValue = Flux.SDK.StreamUtils.GetStringFromStream(value.Stream);          // stream the vall value

            imgData = Flux.Serialization.DataSerializer.Deserialize <cls_Image_Data>(CellValue);
        }
Example #3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            // initialize revit variables
            RvtUiApp = commandData.Application;
            RvtApp   = RvtUiApp.Application;
            RvtUiDoc = RvtUiApp.ActiveUIDocument;
            RvtDoc   = RvtUiDoc.Document;

            // initilaize flux variables
            ProjectNames = new List <string>();
            FluxProjects = new List <Project>();
            FluxDataKeys = new List <Flux.SDK.DataTableAPI.CellInfo>();

            imgData = new cls_Image_Data();

            /*
             * ---open 3d view
             * ---Log into flux
             * ---get project location
             * ---get image geo location
             * translate geo location to xy coordinates
             * ---Get the data from Flux
             * ---deseralize data to cls image data
             * do a search for revit categories based on image data
             * get the revit categories from cls image data
             * find the location of the revit elements by xy coordinates
             * get element parameters
             * change element parameter value
             */

            Open3DView();                               // open a default 3d view
            imgData = new cls_Image_Data("34:34:34", "34:34:34", new List <string> {
                "charlie", "bob"
            });
            string temp = Newtonsoft.Json.JsonConvert.SerializeObject(imgData);

            FluxLogin();                                // log into flux

            return(Result.Succeeded);
        }
Example #4
0
        // create a list of google categories
        public void CategoryComparison(cls_Image_Data imgData)
        {
            #region CATEGORIES
            categories.Add("mechanical", new List <BuiltInCategory> {
                BuiltInCategory.OST_MechanicalEquipment
            });
            categories.Add("machine", new List <BuiltInCategory> {
                BuiltInCategory.OST_MechanicalEquipment
            });

            categories.Add("plumbing", new List <BuiltInCategory> {
                BuiltInCategory.OST_PlumbingFixtures
            });
            categories.Add("duct", new List <BuiltInCategory> {
                BuiltInCategory.OST_DuctCurves,
                BuiltInCategory.OST_DuctFitting, BuiltInCategory.OST_DuctSystem, BuiltInCategory.OST_DuctTerminal
            });

            categories.Add("light", new List <BuiltInCategory> {
                BuiltInCategory.OST_LightingDevices, BuiltInCategory.OST_LightingFixtures,
                BuiltInCategory.OST_Lights
            });
            categories.Add("lights", new List <BuiltInCategory> {
                BuiltInCategory.OST_LightingDevices, BuiltInCategory.OST_LightingFixtures,
                BuiltInCategory.OST_Lights
            });
            categories.Add("lighting", new List <BuiltInCategory> {
                BuiltInCategory.OST_LightingDevices, BuiltInCategory.OST_LightingFixtures,
                BuiltInCategory.OST_Lights
            });

            categories.Add("door", new List <BuiltInCategory> {
                BuiltInCategory.OST_Doors
            });
            categories.Add("window", new List <BuiltInCategory> {
                BuiltInCategory.OST_Windows
            });
            categories.Add("glass", new List <BuiltInCategory> {
                BuiltInCategory.OST_Windows
            });
            categories.Add("wall", new List <BuiltInCategory> {
                BuiltInCategory.OST_Walls
            });
            categories.Add("floor", new List <BuiltInCategory> {
                BuiltInCategory.OST_Floors
            });
            categories.Add("room", new List <BuiltInCategory> {
                BuiltInCategory.OST_Rooms
            });

            categories.Add("column", new List <BuiltInCategory> {
                BuiltInCategory.OST_StructuralColumns
            });
            categories.Add("structure", new List <BuiltInCategory> {
                BuiltInCategory.OST_StructuralColumns
            });
            categories.Add("beam", new List <BuiltInCategory> {
                BuiltInCategory.OST_StructuralFraming, BuiltInCategory.OST_StructuralFramingSystem
            });

            categories.Add("chair", new List <BuiltInCategory> {
                BuiltInCategory.OST_Furniture
            });
            categories.Add("table", new List <BuiltInCategory> {
                BuiltInCategory.OST_Furniture
            });
            categories.Add("sofa", new List <BuiltInCategory> {
                BuiltInCategory.OST_Furniture
            });
            #endregion

            List <Element> elements = new List <Element>();

            for (int i = 0; i < imgData.resultCatetgories.Count; i++)
            {
                List <BuiltInCategory> tempCategories = categories[imgData.resultCatetgories[i]];

                for (int j = 0; j < tempCategories.Count; i++)
                {
                    var stuff = from tempEle in
                }
            }
        }