Ad

Friday, May 28, 2010

Sincpac C3D Source Code

Recently Quux Software released the Sincpac C3D Source Code for Civil 3D. If your an amateur programmer like me I’d suggest you download it and check out the features. If your just starting out being an amateur programmer of Civil 3D then this post is for you. In this post I’ll go over how to get the code set up to work and some of the benefits of using the code as a starting point.

The first thing you need is an Integrated Development Environment program. If your just starting out I’d suggest downloading Microsoft Visual Studio Express for c#. If your planning on doing this more than just occasionally I’d get Visual Studio. (If your using Microsoft Visual Studio Express 2010 you may need to change the .NET framework to 3.5 from the default).  The Sincpac is written in c#, which is quite different than the VBA and vb.NET that I usually blog about.

Once you’ve imagedownloaded the source code and Visual Studio you’ll need to open a solution based on what version of Civil 3D you are building for. The Sincpac comes with solutions for 2008, 2009, 2010 & 2011.  Each solution utilizes the same code in the AcadUtilities, C3DUtilities & SincpacC3D folders. This makes it easy to have code for your routines in one place and makes it easy to compile code for each version of Civil 3D.

For this example I’m working with Civil 3D 2010, so I’ll open QuuxFree2010SNAGHTML2a78b8. Once open you may get warning messages. It should be OK to press the OK button. You’ll then get another error message, go ahead and change the option to Load project Normally. You’ll have to press it three times since there is three SNAGHTML2cb71fassociated solutions with the main solution.

Within the Sincpac there is three solutions. The SincpacC3D 2010 Free Edition contains the commands that the user calls.image This, or another solution, is where you’d place your commands or modify the existing ones. The AcadUtilities2010 and C3DUtilities2010 contain code that helps accomplish the tasks in the SincpacC3D 2010 solution.

For instance the  AcadUtilities contains the Formatter Class. This class helps convert doubles to the correct number format. For instance you can convert a radian value to the correct angle format using the AngleToString.

SNAGHTML330686

In order to compile the code, most likely, the references need to point to the correct location for all three solutions. Thankfully you only have to do this step the first time out.  I find the easiest way is to add a reference folder location. I’ve chosen to use the Civil 3D folder, but it is recommended to use the ObjectARX files, downloadable from the ADN site. Download it and then point the reference folder to that location instead of what I did in the video.

Now you can build the solution, choose to build the entire solution. Now open Civil 3D and use Netload to load the dll. The dll may be found here for a Build Solution:

\FreeEditionV2\SincpacC3D\bin\Release2010

and here for a Debug Release:

\FreeEditionV2\SincpacC3D\bin\Debug2010

The download page has some information how you can have the dll loaded when Civil 3D starts so you don’t have to netload it each time you want to debug a program.

The commands that come with the Sincpac code is: BRKPT, CHELEV, FREEPT, HIDEBND, LABLAY, MOVEPOINTS, NEXTPT, PT2FEATURE, PT2PROFILE, ROTATEMARKERS, ROTATEPOINTS, SELPTGROUP, SGOBJECT, SGRD, SPHELP, SPSETTINGS, STAKEFEATURES, STAOFF, USEDPT, & ZOOMPT. You can find more information about the commands on the Sincpac site.

In the next post I’ll start to add a custom command, using this code as a starting point, to create Civil 3D points from blocks and text.

***Disclaimer: I have received access to the full version of the Sincpac without having to pay for it, which may need to be disclosed due to certain laws of the United States.

Monday, May 17, 2010

AU Voting is Here

From the AU Site:

“Here is your chance to influence which classes will be offered at AU this year. Help us select from the more than 1800 topics submitted by the international AU community. It only takes a few minutes to vote for those sessions that you want to see offered. Voting ends Friday, May 21.  Vote now!

So if you are planning on going to AU or watching on AU Virtual now is your chance to influence the classes chosen. I’d suggest you help out Earl get to the class he wants to attend.

Thursday, May 13, 2010

c# Changing References

Sometimes you come across some code that’s been built on another version of Civil 3D then what you want. In order for it to work you need to change the references. Depending on your development environment you can modify the references the way that’s done in this post, if not the steps are slightly different. For this post I’m changing the references in the Quux’s Free version of the SincPac 3D (available soon), from Civil 3D 2010 to 2011. 

The first step is to add a Reference Path. To do this go to the Project Properties, Reference Path Tab and then add the folder.

You can also add references by right clicking in the Solution Explorer and selecting them from the list or browsing to the location. First you need to delete the reference from the previous or later version.

Now all you should need to do is check for any version API issues and build the code.

Wednesday, May 12, 2010

Adding Layouts to Sheet Set Manager

When using the sample sheet set manager code that ships with Autocad, ObjectARX or Civil 3D make sure to save the drawing first. If you don't you spend a bunch of time trying to figure out what you are doing wrong.
The AutoCAD .NET Developer's Guide provides a way to save a drawing.

Thursday, May 06, 2010

Another AU Proposal

Class Title: An Amateur's Guide to the Civil 3D API

Class Type: Lecture

Class Description:

Learn the basics of the Civil 3D API utilizing .net (vb & c#) from a fellow amateur programmer. Learn the steps on how to get started creating your own custom routines. We’ll take a look at what can be stumbling blocks on completing routines.  We’ll take a look at the best places to find example code, answers to  your programming questions and more. We’ll take a look at publically available source code and how to modify it to create new routines, because starting from scratch is no fun.

Class Length: 2 Hour

Primary Track: Civil Infrastructure

Audience Experience Level: Advanced

Key Learning Objectives 1: Learn the basics of vb.net programming

Key Learning Objectives 2: Find the best places to find sample code and answers to your questions.

Key Learning Objectives 3: Learn some of the pitfalls of learning how to use the Civil 3D API.

Key Learning Objectives 4: Learn how to modify existing publically available source code.

Key Learning Objectives 5: How to convert Civil 3D VBA samples to .net.

Target Audience: Any beginning amateur programmer looking to learn how to get started using the Civil 3D API.

Primary Autodesk Software: Civil 3D, AutoCAD

Class Keyword 1: vb.NET

Class Keyword 2: c#.NET

Class Keyword 3:Programming

Class Keyword 4: Civil 3D API

Class Keyword 5: Sample Code

Prerequisite Knowledge and Skills: Knowledge on how to use Civil 3D. The skill to use the world wide web.

Saturday, May 01, 2010

Civil 3D Custom Pipe Rule

I created a custom pipe rule a while back, but I couldn’t find were I placed it. I found it here:

http://style.civil3dreminders.com/custompiperule

The rule checks the separation distance between incoming pipes as well as the minimum wall OD for the structure based on the manhole wall thickness. It pretty much checks the design similar to the requirements found in this manufacturer’s sizing chart: http://www.cretexnorth.com/Catalog/ercp/ercpmhcbsizingchart.htm

With the new capabilities within the API I think I could revise the rule to have the rule change the wall thickness to be the correct value. Not quite sure if I’m going to do that though, but at least you’d have a warning message. I also should convert the rule to .NET.

LinkWithin

Blog Widget by LinkWithin