Hola, por trabajo ,deje de trabajar en IPipeFittingAndAccessoryPressureDropServer.Creo que es muy interesante crear un complemento por esa via .Por eso lo volvía retomar.
Solo,por ahora tome IPipeFittingAndAccessoryPressureDropServer,para crear un esquema externo.Pero no se,que pasa,que no lo crea.Que me estas faltando?
Aquí estas el código, si alguien pudiera ayudarme.
Ya estuve mirando el UserMepCalculation,pero ahí no lo crea,aunque si reutilice alguno código.
Hi, because of work, I stopped working on IPipeFittingAndAccessoryPressureDropServer. I think it's very interesting to create a plugin that way. That's why I started it again.
Just, for now, take IPipeFittingAndAccessoryPressureDropServer, to create an external schematic. But I don't know, what happens, that I don't create it. What am I missing?
Here is the code, if someone could help me.
I have already been looking at the UserMepCalculation, but I don't believe it there, although I did reuse some code.
public static class PipeSchemaBuildingUtility
{
internal static readonly Guid LongEquivSchemaGuid = new Guid("EC2B52BE-DAA5-4C29-9230-47847A488A3E");
public static readonly string fieldLongEquiv = "ValorLongitudEquivalente";
internal static Schema BuildSchema(Guid schemaGuid, int version)
{
SchemaBuilder sb = new SchemaBuilder(schemaGuid);
sb.SetReadAccessLevel((AccessLevel)1);
sb.SetWriteAccessLevel((AccessLevel)1);
sb.SetVendorId("USER");
sb.SetDocumentation("Version" + version);
if (schemaGuid.Equals(LongEquivSchemaGuid))
{
sb.SetSchemaName("LongitudEquivalente");
sb.AddSimpleField(fieldLongEquiv, typeof(string));
}
return sb.Finish();
}
}
public class LongitudEquivalentePipeFittingAndAccessoryPressureDropServer : IPipeFittingAndAccessoryPressureDropServer
{
public bool Calculate(PipeFittingAndAccessoryPressureDropData data)
{
if (data == null)
{
return false;
}
Entity val2 = new Entity(GetDataSchema());
string text = "Hola Amigo";
val2.Set<string>(PipeSchemaBuildingUtility.fieldLongEquiv, text);
data.SetDefaultEntity(val2);
return true;
}
public Schema GetDataSchema() => Schema.Lookup(PipeSchemaBuildingUtility.LongEquivSchemaGuid) ?? PipeSchemaBuildingUtility.BuildSchema(PipeSchemaBuildingUtility.LongEquivSchemaGuid, 1);
public string GetDescription() => "Mostrar la Longitud Equivalente";
public string GetName() => "Longitud Equivalente";
public Guid GetServerId() => new Guid("6C46D6B9-DFCC-4C07-B98A-EDD9987EA8BB");
public ExternalServiceId GetServiceId() => ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropService;
public string GetVendorId() => "USER";
public bool IsApplicable(PipeFittingAndAccessoryPressureDropData data) => true;
}
Solved! Go to Solution.
Solved by jeremy_tammik. Go to Solution.
In this question, you associate two very different topics. On the one hand, you mention the IPipeFittingAndAccessoryPressureDropServer interface:
https://www.revitapidocs.com/2023/27a15d91-2dcb-41f3-b818-9c6d3c6e17a3.htm
This is an interface class for external servers implementing pipe fitting and pipe accessory coefficient calculation. A typical way to use the external server can be:
You sample code, on the other hand, implements and populates Extensible Storage:
https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.23
There is no connection between these two topics per se.
Therefore, if you run into any problems with either of them, I would recommend separating the two aspects, implementing and testing the respective functionality separately, and ensuring that both of them work correctly before trying to make use of them together.
This is a very fundamental and powerful rule of programming (and politics, and many other areas of human activity): divide and conquer:
https://en.wikipedia.org/wiki/Divide_and_rule
Can't find what you're looking for? Ask the community or share your knowledge.