How can I retrieve parameters of View Sheet before it was created?

How can I retrieve parameters of View Sheet before it was created?

Shai.Nguyen
Advocate Advocate
1,258 Views
3 Replies
Message 1 of 4

How can I retrieve parameters of View Sheet before it was created?

Shai.Nguyen
Advocate
Advocate

Hi Everyone,

I'm exploring the Revit 2022, especially Export PDF.  I'm curious that how can Revit access Parameters of ViewSheet, while my model doesn't have any Sheet?

2021-04-11 11_03_15-Autodesk Revit 2022 - UNREGISTERED VERSION - [TestQuickPrint2022.rvt - Elevation.png

0 Likes
Accepted solutions (1)
1,259 Views
3 Replies
Replies (3)
Message 2 of 4

architect.bim
Collaborator
Collaborator

Hi!

There are two main types of parameters that can be in a list of avalable fields:

  • BuiltInParameters
  • Project Parameters

BuiltInParameter Id can be obtained like this:

 

>>> ElementId(DB.BuiltInParameter.SHEET_NAME)
<Autodesk.Revit.DB.ElementId object at 0x000000000000002B [-1007400]>

 

Project parameter Id can be accessed either through ParameterBindings property or with FilteredElementCollector of class ParameterElement:

 

>>> iterator = doc.ParameterBindings.ForwardIterator()
>>> while iterator.MoveNext():
... 	print iterator.Key.Name, iterator.Key.Id
Occupant 26010
Hinge Set 217757
...

>>> for element in DB.FilteredElementCollector(doc).OfClass(DB.ParameterElement):
... 	print element.Name, element.Id
Occupant 26010
Hinge Set 217757
...

 

After you get necessary parameter Ids you can use them to create TableCellCombinedParameterData objects and pass them to SetNamingRule method of PDFExportOptions class.


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes
Message 3 of 4

architect.bim
Collaborator
Collaborator
Accepted solution

And another solution:

  • start Transaction
  • use CreateSheetList method to create temporary sheet list schedule
  • get all avalable schedulable fields and Ids of their parameters
  • put necessary parameter Ids somewhere (list, collection, dictionary, etc)
  • rollback Transaction

Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes
Message 4 of 4

Shai.Nguyen
Advocate
Advocate

I understood your point and write by using C#

Dictionary<double, string> parameterDict = new Dictionary<double, string>();
Transaction tr = new Transaction(doc, "Create Sheet");
tr.Start();
ViewSheet tempVs = ViewSheet.Create(doc, ElementId.InvalidElementId);
foreach (var para in tempVs.GetOrderedParameters())
{
   parameterDict.Add(para.Id.IntegerValue, para.Definition.Name);
}
tr.RollBack();

Thank you.