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 https://sites.google.com/site/c3dxtreme/home/PipeSample.dll?attredirects=0&d=1
or source code from here and compile it
https://sites.google.com/site/c3dxtreme/home/Pipeedit-V1.zip?attredirects=0&d=1

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 http://caddmando.blogspot.com/2008/12/turn-off-event-viewer-in-civil-3d.html
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
http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html

I have in the past used an operating system hook to capture the Mouse Click Event similar to the process documented here
http://www.vbforums.com/showthread.php?t=358556
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 vb.net instead of having to reference a separate C# .dll with the code
http://forums.autodesk.com/t5/NET/Dynamic-Input/td-p/1339772
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.
http://through-the-interface.typepad.com/through_the_interface/2009/07/providing-information-on-autocad-objects-in-a-tooltip-using-net.html
VB.net version
http://forums.autodesk.com/t5/NET/Pointmonitor-for-VB-net/m-p/2891662/highlight/true#M22368

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!

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...