Cannot get rebar number

Cannot get rebar number

Anonymous
Not applicable
867 Views
4 Replies
Message 1 of 5

Cannot get rebar number

Anonymous
Not applicable

Hi, I have a problem with obtaining rebar number via Revit API. I can spot Rebar number in Revit Lookup tool, but when I retrieve all of the parameters in API by rebar Parameters property I cant find it there. Any attempt to get its value end with null reference exception. What am I missing? 

0 Likes
868 Views
4 Replies
Replies (4)
Message 2 of 5

so-chong
Advocate
Advocate
0 Likes
Message 3 of 5

Anonymous
Not applicable

Yes, I did, I know that Rebar number is TextParameter. In my case I'm passing rebar from previous method so I don't need to filter it, the problem is that it rebar number parameter seems to be missing in rebar object.

 

My work flow looks like this, I create rebar in Revit API, then I want to create rebar container out of those bars. But I also want to put rebar number parameter into one of rebar container parameters, so I look for it... and I'm failing. If I only create bars in Revit API then I'm able to find its rebar number by Revit Lookup, so I'm kind of sure that bar and its number was created properly. Here is the code:

public static Autodesk.Revit.DB.Structure.Rebar CreateRebar(int hostNumberId, XYZ normal, Autodesk.DesignScript.Geometry.PolyCurve polyCurve)
{
//Some logic here
return rebar;
}
public static Autodesk.Revit.DB.Structure.RebarContainer CreateContainer(Autodesk.Revit.DB.Structure.Rebar[] rebar,int hostIdNumber)
{
ParameterSet set = rebar[0].Parameters;
Parameter param = rebar[0].get_Parameter(BuiltInParameter.REBAR_NUMBER);
//Create container etc.
return container;
}

And here is screenshot showing bars created in RevitAPI:

RevitLookUp.png

 

EDIT: "Numer zbrojenia" means rebar number in polish ;]

0 Likes
Message 4 of 5

Anonymous
Not applicable

I met the matter too.Do you have got the solution?

0 Likes
Message 5 of 5

Anonymous
Not applicable

Not really, but I have made work around. I have changed CreateRebar method output for ElementId, so I'm passing this instead of Rebar, then in CreateContainer I'm looking for rebar number using it's ID. I works that way.

0 Likes