Set element parameter user display

Set element parameter user display

Nairda015
Contributor Contributor
553 Views
5 Replies
Message 1 of 6

Set element parameter user display

Nairda015
Contributor
Contributor

Hello I have object like this:

public class ElementParam

{

public string Code {get; set;}

public string En {get; set;}

public string Pl {get; set;}

public string Fr {get; set;}

}

I want to set element shared parameters to ElementParam.Code but display it to user in his language. 

0 Likes
Accepted solutions (1)
554 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni

Just guessing, I assume that you are supporting three languages for the string data, English, Polish and French.

 

And now you would like one of those to be selected for the Code field and displayed to the user.

 

Correct?

 

I am not aware of any built-in support for this functionality in the Revit API. 

 

I think you will have to code a solution yourself for this.

  

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

Nairda015
Contributor
Contributor

Nairda015_0-1623675092580.png

for eg. I have param WB_Access and for Polish user I want display "z dostepem" but when I call method on this element:

//v1
e.LookupParameter("WB_Access").Code
//v2
e.LookupParameter("WB_Access")

I want to get Code (v1) for eg. "WA01" or some kind of integer value corresponding to this string

(v2) or this object 

 

0 Likes
Message 4 of 6

jeremy_tammik
Alumni
Alumni

Sorry, I do not understand what you expect the Revit API to do for you that it does not already do.

 

Have you worked through the getting started material to understand what the standard approach to handling element parameters looks like, and what data types are supported?

 

Support is only provided for simple data types such as integer, real number, string and ElementId.

 

Element parameter values do not provide support for more complex data types or structures like your ElementParam class.

 

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

Nairda015
Contributor
Contributor

I know what type of parameters are supported. That’s why I’m here.

Is there any way to extend support or do you have any idea how to work around it?

Should I write custom properties panel to handle this behavior with shared parameters?
I think it is common problem and it have something in common with units. I see everything in metric but Revit compute this in imperial. I search for similar solution but for string not for double/int (Code in this situation is kind of different language). 

0 Likes
Message 6 of 6

jeremy_tammik
Alumni
Alumni
Accepted solution

> Is there any way to extend support?

  

No.

  

> or do you have any idea how to work around it?

  

Yes, lots. It completely depends on what you wish to achieve.

  

Should I write custom properties panel to handle this behavior with shared parameters?

  

Yes, that is probably the best approach.

  

> I see everything in metric but Revit compute this in imperial.

  

Revit uses the display units in your  current settings in the user interface. I assume that you have set your display units to metric. The internal Revit database units for length measurements are in imperial feet.

  

So, if you wish to read length measurements from the Revit database and convert them to your current display units, you need to implement code to do so. 

  

> I search for similar solution but for string not for double/int (Code in this situation is kind of different language). 

  

The Revit API does not offer any support for handling multiple user interface languages, so you will have to handle that yourself.

   

 

 

 

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