Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Working Plane Grading tools

25 REPLIES 25
SOLVED
Reply
Message 1 of 26
Jeff_M
3133 Views, 25 Replies

Working Plane Grading tools

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
EESignature
25 REPLIES 25
Message 2 of 26
neilyj666
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)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 3 of 26
Jeff_M
in reply to: neilyj666

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
EESignature
Message 4 of 26
neilyj666
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..Smiley Happy

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..Smiley Happy

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..Smiley HappySmiley Happy

neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 5 of 26
Jeff_M
in reply to: neilyj666

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
EESignature
Message 6 of 26
neilyj666
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)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 7 of 26
Jeff_M
in reply to: neilyj666

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
EESignature
Message 8 of 26
neilyj666
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)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 9 of 26
david.garrigues
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

Message 10 of 26
neilyj666
in reply to: david.garrigues

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)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 11 of 26
Jeff_M
in reply to: Jeff_M

Attached is a new DLL for use with C3D2013. I have not yet tested this with the release version of 2013, but it should work without error. If you do encounter any problems, please post about it here.

 

Jeff

Jeff_M, also a frequent Swamper
EESignature
Message 12 of 26
neilyj666
in reply to: Jeff_M

Thanks for this Jeff - I'll test it out later today

neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 13 of 26
neilyj666
in reply to: neilyj666

Only did a quick test but seems to work like a dream...Smiley Happy

 

Was it an onerous task to update the code??

neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 14 of 26
Jeff_M
in reply to: neilyj666

Great, glad it worked. I hate posting things I have't tested myself but I was pretty sure thise should work ok.

 

It wasn't too much trouble to update. I'll post the new VS2010 C# project later on for anyone wanting to see what is different.

Jeff_M, also a frequent Swamper
EESignature
Message 15 of 26
ralstogj
in reply to: Jeff_M

Jeff

 

Gave up on porting the vba code to vb.net as not enough hours in the day. Anyway  I just updated my home laptop to 2013 and tried to load the C# assembly and got the attached error not sure what the issue is as loading from c drive. But first tried to loading from another drive maybe a restart and reload will get it working for me. Will try again tomorrow night.

 

load_error.png

Regards

Justin Ralston
http://c3dxtreme.blogspot.com/
Message 16 of 26
Alfred.NESWADBA
in reply to: ralstogj

Hi,

 

>> and got the attached error

In that case you can modify the file acad.exe.config (placed in the installation folder) and modify it / add the orange marked line:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
<!--All assemblies in AutoCAD are fully trusted so there's no point generating publisher evidence-->
   <runtime>        
	<loadFromRemoteSources enabled="true"/>   
	<generatePublisherEvidence enabled="false"/>    
   </runtime>
</configuration>

That's valid for all Framework 4 based applications.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 17 of 26
ralstogj
in reply to: Jeff_M

Alfred

 

Thanks that did the trick

 

Justin

Regards

Justin Ralston
http://c3dxtreme.blogspot.com/
Message 18 of 26
ralstogj
in reply to: Jeff_M

Guys

 

Just playing around with the .dll build for 2013 and have found that if you do the WorkingPlane2point routine first and then do it again the code crashes out.

 

Jeff any chance you can post the 2013 project code or have a look into it.

 

 

Regards

Justin Ralston
http://c3dxtreme.blogspot.com/
Message 19 of 26
Jeff_M
in reply to: ralstogj

I shall do both in the morning (just now midnight here). I never have tested this myself in 2013, other than making sure it ran.

Jeff_M, also a frequent Swamper
EESignature
Message 20 of 26
Jeff_M
in reply to: ralstogj

Justin, I can run the WorkingPlane2point command multiple times without issue.

 

Attached is the VS2010 project file. Make sure to Unblock the ZIP file prior to extracting it.

 

 

Jeff_M, also a frequent Swamper
EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report