Thursday, 31 May 2012

Making your own Civil3d Custom Pipe Rules

You can make your own custom pipe and structure rules for Civil3d to model your local requirements. To do this with is a little bit involved to start with but worth the effort. To get started

1. Copy the sample pipe project folder and all its contents that ships with Civil3d from the shipping location
C:\Program Files\Autodesk\AutoCAD Civil 3D 2012\Sample\Civil 3D API\C3DPipeNetworkRules
to a new location.

2. Open up the project solution file in Visual Basic Express IDE

3. Fix up the references in the project so they point to the correct paths on your local machine


4.Rename the project to be some thing like C3DPipeNetworkRulesCustom
5.Set the build output path to the location where Civil3d xml pointer file is going to look for pipe rule files

6. Set up the Debug application to be Autocad by opening the .vbprog file and adding the following two lines

7. Setup a custom pipe rule .xml pointer file for Civil3d to load and display your custom rules for selection in Civil3d. As far as I am aware this is not documented by Autodesk anywhere Chris Fugitt from Civil3dReminders summaries the process in his AU2007 paper (page 18 on) which has disappeared from the AU site as it is to old, but I have uploaded here for reference. Hopefully he gets to present the information again at AU or Autodesk add it to the help.

8. I already have a modified .xml with three custom rules added for VBA that I wrote back in 2008 but it has a couple of issues in Civil3d 2012 a new rule PipeEndLocation was added by Autodesk which is missing from my file and the rules point to the old VBA .dvb rules file and not a new .dll therefore do not work unless VBA has been installed on your PC.

9.So to make an updated xml pointer file I made a copy of the new shipped .xml file and copied and pasted my custom rules in xml notepad from the end of the old file onto the new file by having two session of xmlnotepad running next to each other.

Now I adjusted the path to point to the dll and the macro text to what I am assuming should be the “rootnamespace” followed by the class name in the project.

10. Now I have been unable to get my old rules to run using the vba to conversion process so I am am going to have to make the same updates to the copy of the shipped .net pipe rules file as I did to the vba file back in 2008. So in the project file make a few name changes to know where the new rules code is.

11. Now swap out the shipped xml pointer file with your updated xml file.

12. Go back to Visual Basic Express and launch a debug  session by pressing the play button. This will start Civil3d and we will be able to check if the new rules are available and we can debug and step thru your custom pipe rule .dll file

13. Problem I can see the rules and they appear to be pointing to the right .dll file but Civil3d cannot fire the rules in the.dll. Does anyone out there know what the issue could be or have custom rules running in 2012.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...