Monday, 18 April 2011

Civil3d Quick Pipe Edit

Coming up on almost 2 years ago Christopher at Civil3dReminders wrote some code to have the start, end and slope information of pipes displayed within Civil3d using the TransientGraphicsAPI.
I have extended Christopher’s code below in order to create a Quick Pipe Edit (QPE) command along the lines of the built in featureline Quick Elevation Edit command available in Civil3d.   
To use the code download the compiled dll from here
or source code from here and compile it

1. Type Netload at the commandline browse to and load the download project .dll
2. Type QPE at the command line.
Note: Using this command may trigger event viewer to stop the event viewer displaying see the post have
3. Hover the cursor near the start, end or centre of the pipe you want to edit.
4. Information on the specified location is displayed.
5. DoubleClick the mouse button to edit the displayed pipe information.
Note: The slope is always back calculated from the start invert and the end invert adjusted accordingly.
6. Once you have finished type QPEE to end the command and remove the events handlers
The code works as demonstrated in the following screen capture.
Unable to display content. Adobe Flash is required.
Being version 1 of the code  it has limited error trapping and it works for me but is not perfect so use it at your own risk. 
My ultimate goal was the mimic the behaviour of the featureline Quick Elevation Edit command. However I have fallen short in a number of areas.
1. To edit the pipe information a doubleclick is required instead of a single click.
I have not been able to find out now to capturer the event when the user just clicks the left mouse button once. According to the online help there is no leftclick event exposed

I have in the past used an operating system hook to capture the Mouse Click Event similar to the process documented here
but there must be a simpler way with .net now.
2. The pipe information is displayed as text in the drawing and not next to the cursor.
I found a code example here how to do it in C# with and undocumented API call and managed to get it up and running but it needs more work and I would like to convert all the code to instead of having to reference a separate C# .dll with the code
While researching this issue I initially thought I had to display the information in the tooltip. But a tooltip only displays the information temporarily. Here are some links I found on adding information to the tool tip for reference anyway. version

3. You have to end the command by firing another command to remove the event handlers in use.
The initial command sets up a number of event handlers these need to be removed with you are finished with the code. You should be able to use another event like endcommand or esc key press to target a rountine to close the event handlers automatically but I do not know how to implement this at this stage.

Any feedback/comments on how I could implement these changes would be appreciated.

1 comment:

  1. Man really thanks alot your!! code rocks it aint perfect for my needs but man your code really helped me getting started.

    thanks again!


Related Posts Plugin for WordPress, Blogger...