Hello,I've been trying to change the operational (Transient, Valve) Pattern in miy HAMMER project using WO.NET, but I just have been able to see the information, but not to modify anything. I've been looking everywhere in the Hydraulics and Hydrology Forum (because I don't have acces to BDN) and I found this post:
https://communities.bentley.com/products/hydraulics___hydrology/w/hydraulics_and_hydrology__wiki/28467.using-waterobjects-net-for-sewercad
The problem is that at the end they doesn't explain how to edit the values. I already read the WaterObjects.NET Programming Guide, but I couldn't find something useful.
My method I'm building to change the values:
public void ChangeValveClosure(int ID_CURVE, TorontoProject project) { ISupportElementManager CurveSet = project.DomainDataSet.SupportElementManager((int)SupportElementType.IdahoPatternElementManager); IUnitizedField CurveField = CurveSet.SupportElementField(StandardFieldName.TransientValveCurve_RelativeClosure) as IUnitizedField; IUnitizedField CurveFieldT = CurveSet.SupportElementField(StandardFieldName.TransientValveCurve_TimeFromStart) as IUnitizedField; //show values IModelingElement CurveElement = CurveSet.Element(ID_CURVE); FieldCollection Fields = CurveElement.Manager.SupportedFields(); IField ClosureCurv = Fields[32]; CollectionFieldListManagerBase F = (CollectionFieldListManagerBase)ClosureCurv.GetValue(ID_CURVE); FieldCollection Fields2 = F.SupportedFields(); IField TimeCurve = Fields2[0]; IField ClosureCurve = Fields2[1]; IDictionary TimeValues = TimeCurve.GetValues(); IDictionary ClosureValues = ClosureCurve.GetValues(); }
What am I missing? I don't know what else to do.
Im thankfull with any help,
Juan Sebastian.
Answer Verified By: Juan Sebastian Gómez Pinto
Regards,
Jesse DringoliTechnical Support Manager, OpenFlowsBentley Communities Site AdministratorBentley Systems, Inc.
hello Jesse,
I donwloaded the CONNECT edition as Kris recommended to use the ProjectContext.LoadResults method, but is not loading any changes after I use the ComputeHammer method. Here is the code that I'm running and is similiar to the one you send me before:
public bool Execute(double[] CurvaTiempo, double[] CurvaCierre, int i)
{
TorontoProject project = (TorontoProject)aparentFormModel.CurrentProject;
bool itDidIt = true;
junctionIds = NodesID();
TCVvalveIds = TCVValvesID();
ID_CURVE = GetIDCurve(TCVvalveIds);
ChangeValveClosure((int)ID_CURVE, project, CurvaTiempo, CurvaCierre);
if (i != 1)
try
//aparentFormModel.Validate();
aparentFormModel.ComputeHammer(true,
aparentFormModel.CurrentGraphicalProject.DomainDataSet.ScenarioManager.ActiveScenarioID, false);
}
catch (Exception ex)
string a = ex.StackTrace;
MethodBase b = ex.TargetSite;
string c = ex.Message;
int line = (new StackTrace(ex, true)).GetFrame(0).GetFileLineNumber();
itDidIt = false;
projectContext.LoadResults(project.DomainDataSet.ScenarioManager.ActiveScenarioID);
historicalPipes = HistoryPipes(projectContext);
HistoricalNodes = HistoryNodes(projectContext);
CloseResults();
return itDidIt;
I highligthed the only change I made and it isn't loading the canges made after the compute.
Thank you for your help,