- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm using Revit and Revit sdk 2013.
There is something weird happening, and i couldn't find anything related to my problem. I'm trying to find the length of a an instance parameter. Everything works perfectly when i retrieve the parameter.
Here is my code:
Document doc = e.GetDocument();
ICollection<ElementId> addedElem = e.GetAddedElementIds();
foreach (ElementId id in addedElem)
{
Element elem = doc.GetElement(id);
ParameterSet parameters = elem.Parameters;
foreach (Parameter param in parameters)
{
if (param.Definition.Name == "Test Parameter")
{
if (param.AsString() != "")
{
paramString = param.AsString();
int paramLength = paramString.Length;
System.Windows.Forms.MessageBox.Show(paramLength.ToString());
}
}
}
Here's my problem, when i enter a value in my parameter that has a length greater than 10 (ex. "Hello by the way" 16 characters). The length is displayed in a message box (16). However, if i enter a value less than 10 (ex. "Hello" 5 characters) Not even an empty box is displayed. Nothing is happening. It's like if the length of the string is less than 10 characters, it is not being recognized at all.
Anyone faced such a problem?
Regards.
M. Fadel
Solved! Go to Solution.