This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using WaterGEMS tools in WaterObjects.NET

Is it possible to use/call the various tools that are present in WaterGEMS through WaterObjects.NET? I'm mainly interested in the following tools:

- Reverse pipe

- Batch Morph

- Batch Pipe Split

I've already tried to reverse pipes in WaterObjects by interchanging the start and stop nodes of a pipe, and reversing the GeometryPoint[] variable of the pipe (vertices). This seems to work, however when I open the model, the check-valve icon of the pipe is still facing the wrong direction, this can be manualy fixed by updating the drawing though. Is it possible to call the update of the drawing through WaterObjects.NET? I could also separately program each step of the Batch Morph tool, but using the tool directly in WaterObjects.NET would be much easier...

The reverse pipe tool is mainly used to make sure the check-valve in the pipe is working in the correct direction. The batch morph tool will mainly be used to convert taps to junctions after which the batch pipe split tool is used to split the pipes. 

Parents
  • Is it possible to use/call the various tools that are present in WaterGEMS through WaterObjects.NET? I'm mainly interested in the following tools:

    - Reverse pipe

    - Batch Morph

    - Batch Pipe Split

    I checked with one of our developers who indicated that this could get a bit complicated. Could you tell us a bit more about why you need to perform such functions using a Waterobjects.NET tool? What version of WaterObjects/WaterGEMS are you using?

    This seems to work, however when I open the model, the check-valve icon of the pipe is still facing the wrong direction, this can be manualy fixed by updating the drawing though. Is it possible to call the update of the drawing through WaterObjects.NET?

    The appearance of the drawing pane (including the pipes and nodes and "decorations" like the check valve symbol) is stored in the model's .DWH file. Deleting this file would force a re-sync when re-opening the model. Here is some additional feedback from one of our developers:

    If they are opening just the SQLite database using WO.Net, then they may need to check this:

    dataSource.SetConnectionProperty(ConnectionProperty.ShouldUpdateCounters, true);

    This is would be done when they use ConnectionProperty.Filename.  This flag will make sure that internal counters are incremented when geometry is changed (like he does with reverse pipe).  If the counter is correctly incremented, this should also trigger a drawing sync on opening in the UI.


    Regards,

    Jesse Dringoli
    Technical Support Manager, OpenFlows
    Bentley Communities Site Administrator
    Bentley Systems, Inc.

  • Dear Jesse,

    All these tools will be used in a more elaborate workflow, I'd be happy to explain it in more detail in a non-public conference call. 

    I'm opening the model using the following code:

    ProjectManager.OpenProject(NewProjectProperties(ModelDatabasePath));

    I believe it is part of Haestad.Framework.Application

  • Dear Kris,

    Thanks a lot! I will give this a try, having quickly read the code you propose, I can understand what is being done in sequence. It contains the puzzle pieces I was missing!

  • Dear Kris,

    I ran into some problems implementing your code and think I've also come up with some solutions for them but I'm not sure they are correct:

    - In the code for pipe reversal you wrote, I cannot seem to use an HmIDCollection in the using block because it doesn't implement IDisposable. My solution is to cast it to an IHmIDDelayedCollection instead, that does implement IDisposable. 

    - In the code for the batch morph, you declare the CompositeUndoableAction in the try block. This makes it unavailable in the finally block. My solution is to declare the action right before (outside) the try block. 

    - In the code for batch morph, the variable batchDomainManager is declared twice. My solution is to declare it using a different variablename on it's second declaration. 

  • Hi Joeri,

    Sorry about that.  I wrote the code without the benefit of Visual Studio and IntelliSense (straight in the communities editor).

    For the using block of HmIDCollection, use IHmIDDelayedCollection instead.  Change pipeIDs to ids.  Then the first line of the using block should be:

    HmIDCollection pipeIDs = new HmIDCollection((HmIDCollection)ids);

    That should get you going there.

    Yes, on the composite undoable action.  My bad.

    Your way for IBatchDomainManager should work.  You could also try checking to see if it is not null for the second location and then call EndBatch() on it.  That might work.

    I'm still working on getting some usable code for batch pipe split for you to use.

    Kris

  • Hi Kris,

    Do you have any update on the batch pipe split code?  

  • I sincerely apologize for the delay.

    I will get something to you later this morning that should get you going.

    Kris

Reply Children
No Data