Search code examples
c#viewgoogle-sheetsrevit

How to obtain a sheet number for a View with the Revit API


I would like to access the sheet number of a "View view," with the Revit API. I have tried to search for the parameter belonging to a view however it is not listed as a parameter by intellisense. I can see in a document or project that it is a read only sheet number parameter.

    foreach (Element elem in collection)
            {

                View view = elem as View;

                if (view.ViewType == ViewType.FloorPlan)
                {
                    using (Transaction transView = new Transaction(doc, "Set Param"))
                    {
                        transView.Start();

                        int testScale = 100;
                        //set the scale of the view
                        view.Scale = testScale;
                        //get the name of the view
                        message += "\nView name: " + view.ViewName;
                        message += "\nScale after set: " + view.Scale;


                        transView.Commit();
                    }
                }

Solution

  • Shelly is correct. You would need to access it via parameters on the view. BIP is recommended but if you don't mind being language specific you can look up the parameter by it's name that appears in the Revit interface.

    I would also recommend that you get the Revit Lookup tool and install it. It's great for looking through the Revit database and classes, etc. to find what you need...