Announcements

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

User MEP Calculation error

tamsann
Enthusiast

User MEP Calculation error

tamsann
Enthusiast
Enthusiast

Hello everyone

 

I am researching User MEP calculation, and when I tried to run the program, I encountered some errors:

 

  1. Error: "FormatUtils doesn't exist in the current context."
  2. Error: "CS1061 'Selection' does not contain a definition for 'Elements' and no accessible extension method 'Elements' accepting a first argument of type 'Selection' could be found (are you missing a using directive or an assembly reference?)"

 Could someone with experience in fixing these errors please help me? I'm new to this and would greatly appreciate your assistance.1.jpg2.jpg

0 Likes
Reply
Accepted solutions (2)
1,384 Views
16 Replies
Replies (16)

sragan
Collaborator
Collaborator
Accepted solution

Formatutils is an obsolete command that "Formats a number with units into a string based on the units formatting settings for a document."

 

You will have to find another way to do this.

 

FormatUtils Members (revitapidocs.com)

 

 

tamsann
Enthusiast
Enthusiast

Thank a lot for your help. I think I need to spend more time to study about this project.

0 Likes

reylorente1
Advocate
Advocate
Accepted solution

Hola,aqui te dejo UserMepCalculation2024,no obtante, el Revit SDK 2024,tiene un Complemento(Addin) llamado NetworkPressureLossReport, que te puede servir tambien.

Espero que te ayude,y suerte

Hello, here I leave you UserMepCalculation2024, however, the Revit SDK 2024 has a Complement (Addin) called NetworkPressureLossReport, which can also be useful for you.

I hope it helps you, and good luck

tamsann
Enthusiast
Enthusiast

Hello @reylorente1 , Thank you very much for sharing. It's helping me a lot.

0 Likes

jeremy_tammik
Autodesk
Autodesk

I am in the process of editing this thread for a blog post. I found three existing related blog posts:

  

  

The third of these is especially interesting:

  

Revit MEP Calculation

  

The second example is a Revit MEP calculation external service sample for a pressure drop calculation. 

   

It was implemented specifically for this AU class and, as mentioned, uses external commands to add and remove the calculator. A proper calculator will be implemented as an ExternalDBApplication with no external commands involved.

   

It currently just demonstrates the principles and returns hardcoded dummy calculation results.

 
Handout and Class Material

 

The two sample applications discussed above are included in the zip file containing the SD10752 class material sd10752_revit_external_services_arnost_lobel_samples.zip.

 

Jeremy's note to self: the Revit 2014 UserMepCalculation sample is now superseded by this one and should be replaced:

  

  

Has any MEP expert here in the forum ever made use of Arnoลกt's updated sample? 

  

Does it have any useful enhancements over the UserMepCalculation sample we discussed?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

jeremy_tammik
Autodesk
Autodesk

Thank you again for this, @reylorente1 !

  

Edited and shared on the blog:

  

https://thebuildingcoder.typepad.com/blog/2023/07/docs-lookup-mep-calculation-and-aps-devcon.html#6

  

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

jcrios_462
Participant
Participant

Hola @reylorente1 podrรญas ayudarme a instalar UserMepCalculation2024, tu ayuda serรก de gran utilidad. Muchas gracias.

0 Likes

reylorente1
Advocate
Advocate

Si, si existe una manera mรกs rรกpida, realmente no lo sรฉ, pero aquรญ va como lo hago:

1 descarga el UserMep2024
2.Lo abro en .sln
3.Despuรฉs de abierto, lo compilo
4.Despuรฉs abro el ADDin y ve la ruta de mis archivos. cรณmo puedes ver yo cree una carpeta f, despuรฉs ves vs, y despuรฉs puse la carpeta en esa ruta C:\f\vs\UserMepCalculation (Esta ruta es creada por mรญ, pero puedes cambiarlas, siempre y cuando cambie la ruta en el ADDIN
5.Despuรฉs tome el ADDIN y lo guarde en C:\ProgramData\Autodesk\Revit\Addins\2024 o tambiรฉn lo puedes guardar en C:\Users\reylo\AppData\Roaming\Autodesk\Revit\Addins\2024
6.Abres el Revit 2024, y debe aparecer esto, como aparece en la imagen siguienteCaptura de pantalla 2024-01-04 145235.pngCaptura de pantalla 2024-01-04 145309.pngCaptura de pantalla 2024-01-04 145333.pngCaptura de pantalla 2024-01-04 145356.png

Despuรฉs ve a la pestaรฑa System o sistema y toca la Mechanical Setting y en Calculation, aparece la pestaรฑa PessureDrop , en Calculation Method, cรกmbialo por "User Pipe Pressure Drop" y en Flow por "User Plumbing Fixture Flow."

 

Espero que te ayude. Si tienes algรบn problema, no dudes en preguntar,

jcrios_462
Participant
Participant

Hola @reylorente1 , luego de preguntar, seguรญ intentanto y logrรฉ realizar la instalaciรณn, aunque a la hora de compilar obtuve errores en "PressureLossReport", por lo que me vรญ obligado a eliminarlo, pues no tengo conocimiento del tema para resolver los mismos.

 

A continuaciรณn comparto una captura de los errores arrojados.

jcrios_462_0-1704424389264.png

 

Gracias por el paso a paso para la instalaciรณn, estรก muy completo y seguro ayudarรก a muchos mรกs.

0 Likes

reylorente1
Advocate
Advocate

Me parece que estas instalando el UserMep en un revit anterior (puede ser 2023 por ejemplo), ya que estos BuiltInParameter son del Revit 2024.Te recomiendo que revises con el RevitLooup, a ver que te dice el parametro, por ejemplo, el de la fricciรณn de la tuberรญa. No obstante, puedes usar el que trae por defecto, es mucho mรกs completo el reporte

john_mojicaP3U6X
Observer
Observer

Hola @reylorente1. Muchas gracias por la guรญa de instalaciรณn del UserMepCalculation, me fue de mucha utilidad, llevaba bastante tiempo buscando ayuda sobre el tema. Tengo revit 2023, cambiรฉ los buitlinparameter y otro par de cosas mรกs y me compilo sin errores. Ajustรฉ el PlumbingFixtureFlowServer cambiando y ajustando los valores de unidades de consumo y sus respectivos caudales de acuerdo a la normativa de mi paรญs y los cรกlculos se ajustaron correctamente, sin embargo, al momento de generar el reporte  me aparece el siguiente error:

john_mojicaP3U6X_0-1729820381940.png

ยฟsabes como podrรญa solucionarlo?

0 Likes

reylorente1
Advocate
Advocate

Hola,si el error que presenta es que no tienes el fichero PressureLossReport
se fichero estas en tu mรกquina o tu Laptop:
buscalo en estas ruta:
C:\Program Files\Autodesk\Revit 2025\AddIns\MEPCalculation\o copia y lo pega :
aqui,dentro de los ficheros:


Captura de pantalla 2024-10-25 180120.png

Debe funcionar

0 Likes

john_mojicaP3U6X
Observer
Observer

Hola @reylorente1 
Intentรฉ lo que me indicaste pero aรบn asรญ el error continua apareciendo. Tambiรฉn le cambiรฉ el nombre al archivo .xslt a "UserPressureLossReport". Segรบn el mensaje de error, parece que este archivo no se encuentra directamente dentro de la carpeta de UserMepCalculation sino que estรก dentro de otra:

john_mojicaP3U6X_0-1730248338210.png

ยฟsabes que podrรญa estar pasando?

0 Likes

reylorente1
Advocate
Advocate

Revisa en el GeneralsReport,revisa el metodo,HtmlStreamWriter:

public HtmlStreamWriter()
{
try
{
xmlFileName = System.IO.Path.GetDirectoryName( PressureLossReportHelper.instance.Doc.Application.RecordingJournalFilename );
if( xmlFileName != null && xmlFileName.Length > 0 )
xmlFileName = xmlFileName + "\\UserPressureLossReport" + DateTime.Now.Millisecond.ToString() + ".xml";

string strPath = typeof( UserPressureLossReport.WholeReportSettingsDlg ).Assembly.Location;
xsltFileName = Path.Combine(
Path.GetDirectoryName( Path.GetDirectoryName( strPath ) ),
"output", "UserPressureLossReport.xslt" );
//xmlFileName = strPath + "\\UserPressureLossReport" + DateTime.Now.Millisecond.ToString() + ".xml";
//xsltFileName = strPath + "\\UserPressureLossReport.xslt";
xmlWriter = XmlWriter.Create( xmlFileName );
}
catch
{
File.Delete( xmlFileName );
}
}
Este fue el cambio que hice, creo que lo que estas dentro // es lo que trae el programa y ese fue el cambio por el de arriba:
string strPath = typeof( UserPressureLossReport.WholeReportSettingsDlg ).Assembly.Location;
xsltFileName = Path.Combine(
Path.GetDirectoryName( Path.GetDirectoryName( strPath ) ),
"output", "UserPressureLossReport.xslt" );



0 Likes

reylorente1
Advocate
Advocate
tambien puedes quitar el "output" y ponerlo directo,algoa asi:
public HtmlStreamWriter()
{
try
{
xmlFileName = Path.GetDirectoryName(PressureLossReportHelper.instance.Doc.Application.RecordingJournalFilename);
if (xmlFileName != null && xmlFileName.Length > 0)
{
xmlFileName = xmlFileName + "\\PressureLossReport" + DateTime.Now.Millisecond + ".xml";
}
string location = typeof(WholeReportSettingsDlg).Assembly.Location;
location = Path.GetDirectoryName(location);
xsltFileName = location + "\\"UserPressureLossReport.xslt";
xmlWriter = XmlWriter.Create(xmlFileName);
}
catch
{
File.Delete(xmlFileName);
}
},Mira ver si te funciona asi
0 Likes

john_mojicaP3U6X
Observer
Observer

Hola @reylorente1 
Muchas gracias por tu colaboraciรณn. Antes de hacer cualquier cambio en los archivos, cree una carpeta llamada "output" y coloquรฉ el archivo "UserPressureLossReport", ya con esto el reporte sale correctamente.

john_mojicaP3U6X_0-1730336479778.pngjohn_mojicaP3U6X_1-1730336511997.png


Muchas gracias por tu valiosa ayuda. Realmente esto me va ahorrar muchรญsimo tiempo para desarrollar los cรกlculos. Mi siguiente objetivo es intentar crear scripts para calcular otro tipo de redes que tenemos en las edificaciones, por ejemplo, redes de gas, desagรผes de aguas lluvias y residuales, etc.

0 Likes