FluidType.GetTemperature method bug in Revit 2026

FluidType.GetTemperature method bug in Revit 2026

hvarjus
Participant Participant
324 Views
6 Replies
Message 1 of 7

FluidType.GetTemperature method bug in Revit 2026

hvarjus
Participant
Participant

Something has changed in FluidType.GetTemperature method in Revit 2026 and I cannot figure out how to use it so that it works every case. Problems occurs some Revit template immediately but some template it exist after you and new fluid temperature. Problem exists also Revit UI but probably it is same change in FluidType.GetTemperature method. This problem started to occur in Revit 2026 and earlier I have not noticed anything similar.

 

Here is step to reproduce.

1. Open new project by using DefaultMetric template

2. Check Hydronic Supply Fluid temperature, viscosity and density. Everything looks good. I have also added more decimals to Fluid temperature from Project Units but it doesn't affect how it works.

hvarjus_0-1754376954609.png

3. Add new fluid temperature for example 45 celsius for Water. 

hvarjus_1-1754377105322.png

4. After that check system type fluid temperature, density and viscosity again. Viscosity and density is zero because I suspect that FluidType.GetTemperature method return null when temperature from Pipe system type is used.

hvarjus_2-1754377188187.png

 

When I make my own application which try to also read this temperature by using FluidType.GetTemperature method I also got null after new temperature has been added to the fluid. Some reason if I use PipeSystemType temperature rounding with 2 decimal before I give value to GetTemperature method then it seems to work. However I don't want to use this kind of workaround before Autodesk confirm how this method should be used.

 

So I hope so that Autodesk developers checks what has been changed in FluidType.GetTemperature method in Revit 2026. Is there changed some tolerance values how temperature is found? 

 

I noticed similar problem also other Revit template and some template it exist without adding any new temperature like "Metric Multi-Discipline". First I though that should be some template problem but now I suspect bug in FluidType.GetTemperature method.

 

Here is also sample code how I used it: 

hvarjus_3-1754378324439.png

 

Returned FluidTemperature class contains viscosity and density properties which I cannot now read.

 

 

325 Views
6 Replies
Replies (6)
Message 2 of 7

hvarjus
Participant
Participant

I did not get any answer therefore I add test macro code how you can easily reproduce the issue. Attachments also contains project where problem occurs.

 

Here are test code:

using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Plumbing;
using Autodesk.Revit.UI;

namespace temperature
{
   [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
   [Autodesk.Revit.DB.Macros.AddInId("DE6BE330-CBBF-409B-82A5-1D8B9695365E")]
   public partial class ThisApplication
   {
      private void Module_Startup(object? sender, EventArgs e)
      {
      }

      private void Module_Shutdown(object? sender, EventArgs e)
      {
      }

      public void GetTemperature()
      {
         Autodesk.Revit.DB.Document doc = this.ActiveUIDocument.Document;

         PipingSystemType ?pipeSystemType = new FilteredElementCollector(doc)
            .OfClass(typeof(PipingSystemType))
            .Cast<PipingSystemType>()
            .FirstOrDefault(x => x.Name.Equals("Hydronic Supply", StringComparison.OrdinalIgnoreCase));

         if (pipeSystemType == null)
         {
            TaskDialog.Show("Test", "System not found.");
            return;
         }

         FluidType fluidType = (FluidType)(doc.GetElement(pipeSystemType.FluidType));

         var fluidTemp = fluidType.GetTemperature(pipeSystemType.FluidTemperature);
         if (fluidTemp == null)
         {
            double tempCelsius = UnitUtils.ConvertFromInternalUnits(pipeSystemType.FluidTemperature, UnitTypeId.Celsius);

            string fluidNotFound = "Fluid temperature is null by using piping system type temperature:" + tempCelsius;

            TaskDialog.Show("Test", fluidNotFound);
         }
         else
         {
            double tempCelsius = UnitUtils.ConvertFromInternalUnits(pipeSystemType.FluidTemperature, UnitTypeId.Celsius);

            string fluidData = "Temperature: " + UnitUtils.ConvertFromInternalUnits(fluidTemp.Temperature, UnitTypeId.Celsius) +
            "\n Density: " + UnitUtils.ConvertFromInternalUnits(fluidTemp.Density, UnitTypeId.KilogramsPerCubicMeter) +
            "\n Viscosity: " + UnitUtils.ConvertFromInternalUnits(fluidTemp.Viscosity, UnitTypeId.PascalSeconds);

            TaskDialog.Show("Test", fluidData);
         }
      }
   }
}

 

How to reproduce problem.

1. Open GetTemperatureProblem.rvt via Revit 2026.

2. Add new macro and copy paste my test code there (Manage tab -> Macro Manager). Remember save and then build macro by using "dotnet build" command in VS code terminal.

3. Run GetTemperature macro

4. Results should be that fluid data found there are density and viscosity values.

5. Then add new fluid temperature. Check my first message for more details but it should be found following path: System tab -> Plumbing and Piping (small arrow which open Mechanical settings) -> Pipe Settings -> Fluids -> Select water and add new temperature like 45.

6. Run GetTemperature macro again. 

7. Some reason fluid data is not anymore found although any existing temperature is not changed. Could some Autodesk developer explains why this occurs? Is there something changed GetTemperature method in Revit2026 which cause this kind of bug.

 

0 Likes
Message 3 of 7

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @hvarjus ,

I have submitted the issue list item REVIT-240503 [Issue with FluidType.GetTemperature Method in Revit 2026] on your behalf, as this matter requires further investigation and may necessitate a modification to our software. Please note this number for future reference.

I will get back to you as soon as I receive a response from the engineering team.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 4 of 7

hvarjus
Participant
Participant

Hi,

Is there any new information about the issue? I'm interested to hear if there is some workaround which I can use to fix the issue? Like I mention my first post that it works better if I use some 2 decimal rounding. Of course this is something which I cannot use without some Autodesk developer explain what has been changed there?

0 Likes
Message 5 of 7

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @hvarjus ,

Currently, there are no updates. I have requested a response from the Engineering team.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 6 of 7

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @hvarjus ,


Thank you for your patience.

I heard back from the Engineering team.

In Revit 2026, there appears to be a change in how GetTemperature and pipeSystemType.FluidTemperature interact. In some cases, FluidTemperature may no longer exactly match a temperature defined in the fluid table.

As a workaround, you can select the nearest available temperature.

FluidType fluidType = (FluidType)(doc.GetElement(pipeSystemType.FluidType));

         double diff = double.MaxValue;
         double tempToUse = double.NaN;
         foreach (var temp in fluidType)
         {
            if(Math.Abs(temp.Temperature - pipeSystemType.FluidTemperature) < diff)
            {
               diff = Math.Abs(temp.Temperature - pipeSystemType.FluidTemperature);
               tempToUse = temp.Temperature;
            }
         }

         var fluidTemp = fluidType.GetTemperature(tempToUse);





Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 7 of 7

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @hvarjus ,

 

Comment from the Engineering team: The root of the issue is that when any change is made to the fluid table, all values are rounded and resaved. As a result, any reference to the previously unrounded fluid values will be slightly off.

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes