Removing duct insulations from Ducts via code

Removing duct insulations from Ducts via code

dsmith
Advocate Advocate
1,533 Views
4 Replies
Message 1 of 5

Removing duct insulations from Ducts via code

dsmith
Advocate
Advocate

I can add Insulation via code using DuctInsulation.Create  but how can I removing duct insulations from Ducts via code

 

Regards

 

Dave

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

BardiaJahan
Advocate
Advocate

I did a little experiment with ducts and insulation and also used the wonderful 'Revit Lookup' tool to figure out the relationship between those two. As far as I understand the duct element is the host of the insulation element meaning that insulation has a HostElementId parameter which refers to the duct element.

 

The same as doors and windows, I do not know a direct way to retrieve the hosted element from the host (Wall --> doors). The only options I can think of are the following:

1- To use the 'delete' trick. Delete the host (which results in the hosted element been deleted) and iterate over the deleted elements and see which one is an insulation element. Then of course Rollback the delete and delete the insulation separately.

https://thebuildingcoder.typepad.com/blog/2009/06/host-reference.html

 

2- The other option is to iterate over all insulation elements and see which one's HostElementId refers to your duct element. Of course you can add proximity filters, etc to make this option more efficient and faster.

 

 

10.JPG

Message 3 of 5

BIM.Frankliang
Collaborator
Collaborator
Accepted solution

Dear Friend

 

         I used to document.Delete to remove insulation of MEPCurve:

 var ids = PipeInsulation.GetInsulationIds(doc, duct.Id);
 if (ids != null && ids.Any())
 {
        doc.Delete(ids);
 }

Wish it can helpful for you 🙂

 

Best Regards

Frank Liang

TJAD BIM Software Dev Lead

Message 4 of 5

dsmith
Advocate
Advocate

Thanks for your replies. All sorted now.

 

Dave

0 Likes
Message 5 of 5

BardiaJahan
Advocate
Advocate

Could you please share how you resolved it?

0 Likes