Hello All,
Anybody knows how to set "Insulation Thickness" to Pipe. It is showing read only.
Please help.
Regards,
Nitin J.
Solved! Go to Solution.
Solved by cshha. Go to Solution.
Not sure what version of Revit you are using. But at least in Revit 2013 API the InsulationLiningBase has property Thickness and it has public set().
Hi,
looking for the same version. but does not know how to use that.
Regards,
Nitin J.
Here's a quick macro to access the insulation of a pipe. This is for Revit 2012.
For Revit 2013, change any instances of doc.get_Element to doc.GetElement
The proper way to limit the selection of an element is to use an ISelectionFilter as an argument of uidoc.Selection.PickObject, but for the purposes of this macro I've cheated a little and done a quick check afterwards to ensure the element is a pipe.
public void InsulationTest() { UIDocument uidoc = this.ActiveUIDocument; Document doc = uidoc.Document; Reference reference = uidoc.Selection.PickObject(ObjectType.Element, "Pick a pipe"); Element el = doc.GetElement(reference); if (!(el is Autodesk.Revit.DB.Plumbing.Pipe)) return; ICollection<ElementId> insulationIds = InsulationLiningBase.GetInsulationIds(doc, reference.ElementId); foreach (ElementId insulationId in insulationIds) { Element insEl = doc.get_Element(insulationId); Autodesk.Revit.DB.Plumbing.PipeInsulation insulation = insEl as Autodesk.Revit.DB.Plumbing.PipeInsulation; if (insulation != null) {
insulation.Thickness = 0.5; //Set value to whatever you want here, value is always in feet, regardless of the units of your model TaskDialog.Show("Thickness", insulation.Thickness.ToString()); } } }