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: 

taskDialog.Show cut off

2 REPLIES 2
Reply
Message 1 of 3
mliuAP3CU
222 Views, 2 Replies

taskDialog.Show cut off

I have been using TaskDialog.Show() to check my code.

When the window pops up, the message is cut off and I can't extend the window to show the whole message.

Is there a way to make the window bigger to see the whole message? Or another better way to see the message?

(using c# to code)

(also not showing a list but that's a different problem)

This is the code I have been using:

FilteredElementCollector levCollector = new FilteredElementCollector(revitDoc);
List
<Level> levelsCollection = levCollector.OfClass( typeof( Level ) )       .OfType<Level>()       .OrderBy( lev => lev.Elevation )       .ToList();
string stringCollection = levelsCollection.ToString();
TaskDialog.Show("Something",stringCollection);

 screenshot to show problem.

2 REPLIES 2
Message 2 of 3
Mohamed_Arshad
in reply to: mliuAP3CU

HI @mliuAP3CU 

 

ToString() can't work for List, It will return only System.Generic.Collection.

The thing is In the Level class we have no of properties, So not able to convert the List<Level> to String. we need to Select Property which needs to convert as one string variable. Kindly refer to the below code for additional reference.

 

            FilteredElementCollector levCollector = new FilteredElementCollector(revitDoc);
            List<Level> levelsCollection = levCollector.OfClass(typeof(Level))
                  .OfType<Level>()
                  .OrderBy(lev => lev.Elevation)
                  .ToList();

            string stringCollection = string.Empty;

            foreach(Level level in levCollector)
            {
                stringCollection += level.Name + " " + level.Elevation * 304.8+"\n";
            }

            TaskDialog.Show("Something", stringCollection);

 

Reference Image:

 

arshad99_0-1686190772009.png

 

 

 

Few Links

URL: https://stackoverflow.com/questions/4981390/convert-a-list-to-a-string-in-c-sharp 

https://stackoverflow.com/questions/15945924/how-do-i-convert-listclass-to-string 

 

Hope this Helps 🙂

Thanks & Regards,
Mohamed Arshad K
Message 3 of 3

 

try
{
  FilteredElementCollector levCollector = new 
  FilteredElementCollector(revitDoc);
  List<Level> levelsCollection = levCollector.OfClass( typeof( Level ) )
        .OfType<Level>()
        .OrderBy( lev => lev.Elevation )
        .ToList();
  string stringCollection = levelsCollection.ToString();
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message)
  return Result.Cancelled;
}

 

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

Post to forums  

Forma Design Contest


Rail Community