Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Varying Rebarset - Rebar Numbers

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
daniel
1571 Views, 4 Replies

Varying Rebarset - Rebar Numbers

HI, 

I am trying to access all the Rebar numbers in my document..

 

Usually I do this by accessing the elements parameter (rebar number) and withdraw the value. 

 

In the case of varying rebar set, I can't find the values inside of the rebarset. Is this value not available ? ?? 

 

Is there any other way of retrieving all the numbers ? 

 

The use case is when I Want to duplicate a schedule, which has a filter on Rebar numbers, and I try to create multiple schedules with 

series of rebar numbers (1-20, 21-40... ) to put these schedules on sheets.. Then I need all the available values, so that I can populate a combobox.. 

 

Daniel 

 

4 REPLIES 4
Message 2 of 5
JimJia
in reply to: daniel

Dear Daniel Aase,

 

Please accept our sincerer apology for the delay! We had a backlog in the queue these days.

 

Yes, as far as I know, the API to access rebar number is to use element parameter. Regarding rebar set, Revit doesn't support this because it's not Rebar element.

 

Besides, in order to diagnose deeply, could you isolate your test project and send us a small, reproducible sample? Note, please do not send us any information you think are confidential to your company.

 

We appreciate your understanding and your patience again!


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
Message 3 of 5
manuel.solis.lopez
in reply to: daniel

Hi,
Varying rebar sets are special since each rebar in the set gets a "Rebar Number". In order to retrive a specific parameter for a bar position you could use ParameterValueProvider or Rebar.GetParameterValueAtIndex(...) Method

 

var pVal = rebar.GetParameterValueAtIndex(new RvtDB.ElementId(BuiltInParameter.REBAR_NUMBER), 0) as StringParameterValue;
var rebarNumber = pVal.Value;
Message 4 of 5
JimJia
in reply to: manuel.solis.lopez

Thanks for Manuel.solis.lopez's sharing! The GetParameterValueAtIndex should be the answer! note that this API is available since Revit 2017.


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
Message 5 of 5

Good day, I try to apply a filter rule based on the Rebar Number, as I have it in my code does not work, I do not know what I can be doing wrong. Thank you.

 

try
            {
                Element e = SelectElement(uidoc, sel) as Rebar;
                Rebar rb = e as Rebar;

                var parNumber = rb.GetParameterValueAtIndex(new ElementId(BuiltInParameter.REBAR_NUMBER), 0) as StringParameterValue;
                var rebarNumber = parNumber.Value;
                int valueNumber = Convert.ToInt32(rebarNumber);

                TaskDialog.Show("ff", valueNumber.ToString());

                //crear filtro
                ParameterValueProvider provider = new ParameterValueProvider(new ElementId(builtRebarNumber));
                FilterNumericRuleEvaluator evaluator = new FilterNumericEquals();
                FilterRule rule = new FilterIntegerRule(provider, evaluator, valueNumber);
                ElementParameterFilter filter = new ElementParameterFilter(rule);

                //collector
                FilteredElementCollector collector = new FilteredElementCollector(view.Document, view.Id);

                //obtener todas las barras
                collector.OfCategory(BuiltInCategory.OST_Rebar).WherePasses(filter);
                ICollection<ElementId> rebars = collector.ToElementIds();

                uidoc.Selection.SetElementIds(rebars);

            }
            catch { }

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community