Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Cann't hide elements

Anonymous

Cann't hide elements

Anonymous
Not applicable

I tried to hide/show element in a view but I got the error message:

 

"One of the elments cannot be hidden. Parameter name:elementIdSet"

I used this piece of code befor to hide show text on a view but it is not working now. The model contain links also. What is the the wrong in this code:

List<ElementId> allId = new List<ElementId>();

//I add the elementsId in allId

try
{
view = (Autodesk.Revit.DB.View)doc.ActiveView;
// ss += view.Name + "\n";
MessageBox.Show("View " + view.Name);

}
catch (Exception ex)
{
MessageBox.Show("View " + view.Name + " could not reviewed\n");
}
try
{
Transaction hide = new Transaction(doc, "Hide the elements");
hide.Start();
if(allId.Count>0)
view.HideElements(allId);

hide.Commit();
}
catch (Exception ex)
{
MessageBox.Show( "View " + view.Name + "can not be hiden \n"+ex.Message);
}

 

 

0 Likes
Reply
Accepted solutions (1)
1,474 Views
3 Replies
Replies (3)

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @Anonymous ,

You have a list of elements.

Use CanBeHidden method to check whether the element can be hidden.

Create one more list and collect those elements which cannot be hidden.

Examine the list and find out which element causes this error.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes

Anonymous
Not applicable

Thank you for the answer. It works

0 Likes

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

If this helped solve your problem please mark it as a solution😁


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes