MEP Calculated Values in Shared Parameter

MEP Calculated Values in Shared Parameter

HeinWelman
Explorer Explorer
1,306 Views
1 Reply
Message 1 of 2

MEP Calculated Values in Shared Parameter

HeinWelman
Explorer
Explorer

Is there any way of calculating a value from two existing parameters and reporting it to a Shared Parameter by using the Revit API?

My aim is to use this in a Tag to display a different flow value through a pipe.

 

I have seen a plugin doing it for Room Area and occupancy.

 

The image attached shows the parameters i'm using,

"Pressure Factor" & CW Flow are Shared Parameters.

 

The result im looking for:

"Flow/Pressure Factor=CW Flow"

 

Thanks

0 Likes
Accepted solutions (1)
1,307 Views
1 Reply
Reply (1)
Message 2 of 2

Joe.Ye
Alumni
Alumni
Accepted solution

 

Hi,

 

This is possible to be done by Revit API.

 

You can read the two shared parameters value first, then calculate the value Flow/Pressure Factor, finally assign the value to CW flow parameter.

 

here is the code fragment

 

Pipe pipe = null;

//pipe is the target pipe. retrieve one target pipe and assign it to pipe variable.

 

Parameter flowParam = pipe.get_Parameter("Flow");

Double flowValue = flowParam.AsDouble();

Parameer pressureParam = pipe.get_Parameter("Pressure Factor");

Double pressureValue = pressureParam.AsDouble();

double cw = flowValue/PressureValue;

pipe.get_Parameter("CW Flow").Set(cw);

 

Hope this helps.



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes