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: 

How to use the Sample API provided in Civil 3D

12 REPLIES 12
Reply
Message 1 of 13
SteadyT
876 Views, 12 Replies

How to use the Sample API provided in Civil 3D

Hi everyone,

 

This is going to seem a very simple question I believe, but I was wondering how I could use on of the sample Civil 3D API that is provided?

 

In particular, I would like to use the ExporttoExcel Sample API provided at the following location during the install:

 

C:\Program Files\Autodesk\AutoCAD Civil 3D 2013\Sample\Civil 3D API\DotNet\CSharp\PipeDataExcel

 

I am not a programmer and can not just load this sample as it is a .cs file.  How would I go about using the code already provided to create a plugin into my AutoCAD to be able to use this command?

 

Thank you to anyone who responds to this.

Ed

 

 

12 REPLIES 12
Message 2 of 13
SteadyT
in reply to: SteadyT

I'm just bumping this up to the top to see if there is anyone out there that can help me.  Thank you in advance.

Message 3 of 13
andrewpuller3811
in reply to: SteadyT

Try these -

 

The .NET GETTING STARTED topic over at the swamp http://www.theswamp.org/index.php?board=27.0

 

and Kean's getting started blog post here

 

http://through-the-interface.typepad.com/through_the_interface/2006/07/getting_started.html

 



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 10 Enterprise 64bit
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2021
Message 4 of 13
Partha.Sarkar
in reply to: SteadyT

Hi,

The "ReadMe" file has all the instructions -

 

C:\Program Files\Autodesk\AutoCAD Civil 3D 2013\Sample\Civil 3D API\DotNet\CSharp\PipeDataExcel

-

----------------------------------------------
This samples illustrates how to work with pipe networks and move data to and from MS Excel using COM interop.

 

It defines two commands:
ExportToExcel - exports pipe data to excel
ImportFromExcel - imports the same pipe data from excel, updating the pipe network

 

Building the sample: This project requires two Microsoft Office interop libraries (Microsoft Office 12.0 Object Library, and Excel 12.0 Object Library) installed with Excel, as well as AecBaseMgd, AecDBMgd, AcMgd, and AeccDbMgd.

 

Using the sample: Open a drawing with at least one pipe network and run the ExportToExcel command. 
This exports information about the pipe network pipes and structures to an Excel document. 
Change values as required in the spreadsheet, then run the ImportFromExcel command to apply the
changed values to the open document.
---------------------------------------------------------

You could use VS2010 or Express to build the .NET application using the source code provided in the example. Then use NETLOAD command to load the DLL you built and invoke the custom command.

 

Let me know if you need any further help.

 

Thanks,



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Message 5 of 13
drenaud
in reply to: Partha.Sarkar

I'm having trouble locating AecDBMgd. Was it included in a C3D 2016 install? Note, that we had to REM the C++ lines from setup.ini to get it to install.

 

THANKS

Message 6 of 13
Jeff_M
in reply to: drenaud


@drenaud wrote:

I'm having trouble locating AecDBMgd. Was it included in a C3D 2016 install?


AeccDbMgd.dll is in the Program Files\Autodesk\AutoCAD 2016\C3D folder

AecBaseMgd.dll is in the Program Files\Autodesk\AutoCAD 2016\AEC folder

Jeff_M, also a frequent Swamper
EESignature
Message 7 of 13
drenaud
in reply to: Jeff_M

thanks. I assume that the readme.txt file is incorrect and mispelled the name of AeccDbMgd.dll .  I suppose i will find out when i get it to run.

Message 8 of 13
Jeff_M
in reply to: drenaud

Which readme.txt are you seeing this in? 

 

BTW, I mis-typed the folder for the AecBaseMgd file...it is in the ACA folder, not AEC

Jeff_M, also a frequent Swamper
EESignature
Message 9 of 13
drenaud
in reply to: Jeff_M

C:\Program Files\Autodesk\AutoCAD 2016\C3D\Sample\Civil 3D API\DotNet\CSharp\PipeDataExcel\readme.txt

 

it says "... as well as AecBaseMgd, AecDBMgd, AcMgd, and AeccDbMgd."

 

only one "c."

 

I'm still plodding away at this. I don't know how to run a .cs. I read that I have to compile into a .NET using Visual Studio. I'm doing a few things at once, so haven't had a chance to try that yet.

Message 10 of 13
Jeff_M
in reply to: drenaud

Ah, ok, yes, that is a typo..it should be AcDbMgd

And, yes, you need to use a .NET compiler. The easiest I've found is the Visual Studio 2013 (or 2015) Community Edition. It's free to use as long as you are developing for an Enterprise solution. Load the project into that and it should automatically find the correct Autodesk based references, but you will to point it to the correct location for Excel
Jeff_M, also a frequent Swamper
EESignature
Message 11 of 13
drenaud
in reply to: Jeff_M

Thanks Jeff. I just started VS 2015. Hopefully i won't be back to ask more questions, but don't count on it!  🙂

Message 12 of 13
drenaud
in reply to: drenaud

OK, this is not going well. to be expected from someone who has never used VS i suppose. but when i try to run or debug the code it returns several erros. I think that it becaquse it is intended to be run from *within* acad.

 

my question now is: is there an AUTODESK guide on how to use their sample code?

 

thanks

Message 13 of 13
Jeff_M
in reply to: drenaud

Yes, these samples are meant for use in C3D. If you want to see an example for an externally run program, which must use the COM API, look under the COM folder in the Samples.

The tutorials at ADN are good for getting you started with the Autocad environment. http://usa.autodesk.com/adsk/servlet/index?id=1911627&siteID=123112 Check out the MyFirst AutoCAD Plug-in guide video, as well as the self paced .NET Labs on that page
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