BuiltInParameter Invalid

BuiltInParameter Invalid

Anonymous
Not applicable
2,325 Views
4 Replies
Message 1 of 5

BuiltInParameter Invalid

Anonymous
Not applicable

Hello friends, I need help, how do I get the AsString of a parameter with invalid built-in parameter? , thank you very much for your attention

 

CapturaAF1_LI.jpgCapturaAF2_LI.jpgCapturaAF3_LI.jpg

0 Likes
Accepted solutions (1)
2,326 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk
Accepted solution

Some parameters are built in, so you can use the BuiltInParameter enumeration value to identify and access them.

 

Others are not built in, but are generated by other means.

 

For those, you can use the parameter id or the display string.

 

For shared parameters, you can also use the GUID.

 

As you show us in your screen snapshot, RevitLookup is able to display the parameter value.

 

You can debug RevitLookup yourself and see how it does that.

 

Look at the Element.Parameter property to see the different options to read a specific parameter value from an element:

 

https://apidocs.co/apps/revit/2019/a742d71a-b415-9e99-2978-abd3b5bae7f2.htm

 

You can also use GetParameters to get all parameters of a specific display name:

 

https://apidocs.co/apps/revit/2019/0cf342ef-c64f-b0b7-cbec-da8f3428a7dc.htm

 

LookupParameter also exists and just returns the first parameter found with a specific display name:

 

https://apidocs.co/apps/revit/2019/4400b9f8-3787-0947-5113-2522ff5e5de2.htm

 

That is obviously risky if more than one might exist.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 5

Anonymous
Not applicable

Thanks Jeremy, your answer helped me a lot, I use LookuParameter, this is my code in case someone needs

 

Parameter p = e.LookupParameter("Sector");

if (p.StorageType == StorageType.String)

{

   var q =p.AsString();

   p.Set(Convert.ToString(q));

}

 

Thank you very much Jeremy, regards

Message 4 of 5

aaron_rumple
Enthusiast
Enthusiast
When parsing the BuiltInParameters in Dynamo (Python Script) and trying to pull the LabelUtils.GetLabelFor to the human readable label, there are several bips that come up with nothing for the label. (And one invalid, so haven't figured that out either.)
These bips do have strings (or should) as says the API.
 
I'm guessing this is something not right in either IronPython or Dynamo's implementation. Not sure where to post this as a bug.
 
Autodesk.Revit.DB.BuiltInParameter,STRUCTURAL_CONNECTION_SYMBOL,
Autodesk.Revit.DB.BuiltInParameter,STAIRS_LANDINGTYPE_TREADRISER_TYPE,
Autodesk.Revit.DB.BuiltInParameter,SPACE_PEOPLE_ACTIVITY_LEVEL_PARAM,
Autodesk.Revit.DB.BuiltInParameter,RBS_DUCT_FITTING_LOSS_TABLE_PARAM,
Autodesk.Revit.DB.BuiltInParameter,SPACING_JUSTIFICATION,
Autodesk.Revit.DB.BuiltInParameter,SPACING_APPEND,
Autodesk.Revit.DB.BuiltInParameter,SURFACE_PATTERN_ID_PARAM,
Autodesk.Revit.DB.BuiltInParameter,INVALID,
    myBuiltInParameterData = []
    myBuiltInParameterError = []
    for bip in myBuiltInParameters:
    try:
    myBuiltInParameterData.append([LabelUtils.GetType(bip), bip, LabelUtils.GetLabelFor(bip)])
    except:
    myBuiltInParameterError.append([LabelUtils.GetType(bip), bip, None])
    myBuiltInParameterGroups = System.Enum.GetValues(BuiltInParameterGroup)

 
0 Likes
Message 5 of 5

jeremy_tammik
Alumni
Alumni

You can submit a problem report right here, if you like.

 

Please provide am minimal reproducible case for it, e.g., a minimal sample project containing a macro that reproduces the problem:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

In this case, the BIM project can basically be empty, and the macro is the only important aspect.

 

Zip it up into an archive file and attach it to your message.

  

Thank you!

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes