AutoCAD Civil 3D Customization

Reply
*Expert Elite*
Jeff_M
Posts: 4,231
Registered: ‎07-22-2003
Message 1 of 26 (1,166 Views)
Accepted Solution

Working Plane Grading tools

1166 Views, 25 Replies
01-29-2012 10:12 PM

At AU 2008 David Garigues presented a class "Caffeinated Grading" in which he used some VBA macros. The VBA code was shared as part of the class and posted the the now defunct CivilCommunity files section. Starting with C3D2010 the VBA DVB was included under the Samples folder in a typical C3D installation, but the code was not kept up to date. And with VBA being phased out, it seemed like the logical choice was to port the code to a .NET DLL. 

 

As it turned out, Justin Ralston and I somehow managed to to be thinking the same thing, at about the same time. He chose to go the VB.NET route, and I chose C# as the program language. The 2 versions may be slightly different (I have not tested his code) but they should yield the same results.

 

And with that, I am attaching the complete VS2008 C# solutions, along with the Readme.txt, in a ZIP. Due to C3D not having a .NET managed API for Surfaces until 2012, the code uses the COM libraries. This means each version of C3D needs it's own version of this DLL. The code is included for all 3 versions of C3D 2010-2012.

 

There are likley better ways to do some of the things in this code using native .NET methods, but I decided to focus on just getting the code ported over with minimal changes to the original. I hope some of you find it useful, both the new commands and the example code.

 

Jeff_M, also a frequent Swamper
*Expert Elite*
neilyj
Posts: 3,706
Registered: ‎08-01-2008
Message 2 of 26 (1,158 Views)

Re: Working Plane Grading tools

01-30-2012 12:52 AM in reply to: Jeff_M

Excellent - many thanks Jeff.....although a couple of comments....

 

1. I couldn't see the readme file in the zip

 

2. When using the commands and being prompted for the first point it isn't clear that it must be a "proper" point e.g. Civil Point (this may be in the readme though). Would it be a great hassle to modify the code such that for the first point the user can also pick any XY location and be prompted for the level (or surface from which to obtain the level)??

 

3. Presumably these commands can be added to a toolbar/pallete etc in the usual way??

 

Thanks again

neilyj
(No connection with Autodesk other than using the products in the real world)


IDSP Premium 2015 (mainly Civil 3D 2015 UKIE & Infraworks with some limited 3ds Max Design)
Win 7 Pro x64, 240Gb SSD, 1Tb HDD
32Gb Ram Intel Xeon CPU E5-2650 v2 @ 2.6GHz (32 CPUs), ~2.6GHz
NVIDIA Quadro K4000, Dual 27" Monitor, Dell T5610
*Expert Elite*
Jeff_M
Posts: 4,231
Registered: ‎07-22-2003
Message 3 of 26 (1,151 Views)

Re: Working Plane Grading tools

01-30-2012 06:23 AM in reply to: neilyj

1. The readme is iin the zip, at the root level:

1-30-2012 6-09-44 AM.png

2. I didn't include any instructions for the actual usage other than what was originally included with the VBA macro. To be honest, I have not used these commands much (in the VBA form or this new one) so am not real familiar with HOW they are supposed to be used. All pick points allow random picks, no need to select a C3D point (in fact, no provision is given for selecting a Point object so I'm not sure about this question...) As for adding the elevation prompt, I think you can just use te normal Autocad filters (.xy, then it prompts for the z), and the option is there to select from a surface (although I did not test this option as it was late, is this not working? I won't be able to test myself until this evening.)

 

3. Yes, these are new commands added to the Command pool, once the DLL is loaded, so they may be used as any other C3D command.

Jeff_M, also a frequent Swamper
*Expert Elite*
neilyj
Posts: 3,706
Registered: ‎08-01-2008
Message 4 of 26 (1,147 Views)

Re: Working Plane Grading tools

01-30-2012 07:09 AM in reply to: Jeff_M

Thanks for the reply:

 

1. I just unzipped the zip and couldn't find the readme as it was in the root - but ok now and the commands make more sense after reading it..:smileyhappy:

2. I had forgotten about using the .XY filter, this does indeed allow a Z to be entered. If a C3D point is selected then the level is obtained from the point. The Surface level option also works fine..:smileyhappy:

3. By putting the DLL in the support path, I assume it gets loaded every session so I can create a toolbar button with for example, ^C^CWORKINGPLANE2POINT as the command macro??

 

I hvae been using these routines today and they are working well and saving me quite a bit of time..:smileyhappy::smileyhappy:

neilyj
(No connection with Autodesk other than using the products in the real world)


IDSP Premium 2015 (mainly Civil 3D 2015 UKIE & Infraworks with some limited 3ds Max Design)
Win 7 Pro x64, 240Gb SSD, 1Tb HDD
32Gb Ram Intel Xeon CPU E5-2650 v2 @ 2.6GHz (32 CPUs), ~2.6GHz
NVIDIA Quadro K4000, Dual 27" Monitor, Dell T5610
*Expert Elite*
Jeff_M
Posts: 4,231
Registered: ‎07-22-2003
Message 5 of 26 (1,144 Views)

Re: Working Plane Grading tools

01-30-2012 07:30 AM in reply to: neilyj

1. Great!

2. Greatx2!

3. No, the DLL still needs to be loaded when C3D starts, or when the command is invoked. Here is a detailed explantion of how to do this in the registry.Link to Kean's blog Alternatively, you could have it load at startup by adding a line to your acad.lsp file. But once loaded, then the macro you show will work.

Jeff_M, also a frequent Swamper
*Expert Elite*
neilyj
Posts: 3,706
Registered: ‎08-01-2008
Message 6 of 26 (1,138 Views)

Re: Working Plane Grading tools

01-30-2012 07:37 AM in reply to: Jeff_M

I'm not to keen on modifying the Registry - what is the syntax for modifying acad.lsp (and where is acad.lsp usually located)?

neilyj
(No connection with Autodesk other than using the products in the real world)


IDSP Premium 2015 (mainly Civil 3D 2015 UKIE & Infraworks with some limited 3ds Max Design)
Win 7 Pro x64, 240Gb SSD, 1Tb HDD
32Gb Ram Intel Xeon CPU E5-2650 v2 @ 2.6GHz (32 CPUs), ~2.6GHz
NVIDIA Quadro K4000, Dual 27" Monitor, Dell T5610
*Expert Elite*
Jeff_M
Posts: 4,231
Registered: ‎07-22-2003
Message 7 of 26 (1,135 Views)

Re: Working Plane Grading tools

01-30-2012 07:54 AM in reply to: neilyj

acad.lsp is placed in any one of the support folders listed under Options->Files->Support File Search Path. I prefer to add my own folder to the top of the list, this way it is always seperate from C3D's install and it can be used with multiple installs if desired.

 

acad.lsp is just a text file, edited with any text editor such as Notepad. If one doesn't exist (C3D does not ship with one, this is a user customization file) just create it. To load .NET dll's, add the following code:

(defun S : Startup() ;;remove the spaces before and after the colon
   (command "netload" "filetoload.dll") ;;one line for each dll
)

 

 

Note, I believe the lisp shown should work, but I use the Registry method so I have not tested this. A Google search should be able to help if this doesn't do it for you.

 

Jeff_M, also a frequent Swamper
*Expert Elite*
neilyj
Posts: 3,706
Registered: ‎08-01-2008
Message 8 of 26 (1,131 Views)

Re: Working Plane Grading tools

01-30-2012 08:07 AM in reply to: Jeff_M

Many thanks - will give it a try

neilyj
(No connection with Autodesk other than using the products in the real world)


IDSP Premium 2015 (mainly Civil 3D 2015 UKIE & Infraworks with some limited 3ds Max Design)
Win 7 Pro x64, 240Gb SSD, 1Tb HDD
32Gb Ram Intel Xeon CPU E5-2650 v2 @ 2.6GHz (32 CPUs), ~2.6GHz
NVIDIA Quadro K4000, Dual 27" Monitor, Dell T5610
Valued Contributor
DavidGarrigues5269
Posts: 63
Registered: ‎12-10-2004
Message 9 of 26 (1,129 Views)

Re: Working Plane Grading tools

01-30-2012 09:30 AM in reply to: Jeff_M

Too funny!  I came up here to ask something today and what do I see.... PLANE GRADING!!!  I have to tell you I use this command a lot.  I wanted to give everyone our updated one that has been modified/converted to work still in VBA (2011).  I too had to make a slight modification because we wanted our users to know if they picked a 0 elevation first we give them a little alert box notifying them.

 

Funny stuff... the actual creator of this was the Chris Putnam who created this on his sabbatical (the guy is truly committed and we love him very much!)

 

I am thrilled it has been converted to .Net and C#  thanks you guys so so much I think we will probably dump the one we are posting here and pick up the new better stuff :-)

dg

*Expert Elite*
neilyj
Posts: 3,706
Registered: ‎08-01-2008
Message 10 of 26 (1,117 Views)

Re: Working Plane Grading tools

01-30-2012 12:51 PM in reply to: DavidGarrigues5269

It's a tool I've been needing since C3D 2011 and someone had blogged about the AU caffeinated grading paper and it went from there....

 

Jeff has done a supreme job (as usual):smileyhappy:

neilyj
(No connection with Autodesk other than using the products in the real world)


IDSP Premium 2015 (mainly Civil 3D 2015 UKIE & Infraworks with some limited 3ds Max Design)
Win 7 Pro x64, 240Gb SSD, 1Tb HDD
32Gb Ram Intel Xeon CPU E5-2650 v2 @ 2.6GHz (32 CPUs), ~2.6GHz
NVIDIA Quadro K4000, Dual 27" Monitor, Dell T5610

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Civil 3D Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for AutoCAD Civil 3D helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Civil 3D

Twitter

Facebook

Blogs