AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Valued Contributor
raghulan
Posts: 92
Registered: ‎01-11-2012
Message 1 of 11 (552 Views)

Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

552 Views, 10 Replies
09-23-2012 09:58 PM

Hello Ppl, 

 

 I have this issue, 

I want to export civil3D pipe, road, alignment as SDF file with additional properties.

currently civilSDF Export option only has limited options for exporting for civil 3D objects.

 

Basically I am developing an app It would export selected feature(eg: pipe) with all available properties such as material, radius, etc.

 

I tried an example online - which showed how to create SDF file and fetch data from layers. which is not usefull in my case.

 

I want to do exactly like the civilsdf export tool with additional properties can be selected.

 

if anyone help me with, how I can get geometry data of pipes or an exmple atleast that would be great.

 

Thanks guys.!

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
Distinguished Mentor
andrewpuller3811
Posts: 777
Registered: ‎07-30-2008
Message 2 of 11 (541 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-24-2012 05:10 AM in reply to: raghulan

have a look at the infrastructure dev blog here-

 

http://adndevblog.typepad.com/infrastructure/

 

There are a few examples of working with civil 3d objects.

If this fixed your issue, click on "Accept as Solution"

Andrew Puller
Maitland, NSW, Australia
Windows 7 Enterprise 64bit
Intel core i7 2600 @ 3.40 GHz with 16GB Ram
Civil 3d 2013 64bit
Valued Contributor
raghulan
Posts: 92
Registered: ‎01-11-2012
Message 3 of 11 (534 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-24-2012 04:49 PM in reply to: raghulan

Thanks for the reply. but I couldnt find anything relavent to pipes in there.

If there is any code snippet that would be great.

 

Cheers

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
*Expert Elite*
Civil3DReminders.com
Posts: 2,522
Registered: ‎10-13-2005
Message 4 of 11 (523 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-24-2012 10:39 PM in reply to: raghulan

Check out:

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

 

Christopher

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Valued Contributor
raghulan
Posts: 92
Registered: ‎01-11-2012
Message 5 of 11 (518 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-24-2012 11:21 PM in reply to: Civil3DReminders.com

I cheked it but it doesnt give anywhere for getting geometry of the pipes.

Is there any example on how to get the geometry of the pipe or create gemetry data of pipes to be stored in an SDF file from the start and end point of the point.

 

Cheers

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 6 of 11 (515 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-25-2012 01:40 AM in reply to: raghulan

I don't see any API available to export Civil 3D objects other than using the ExportToSDF  command (Export Civil Objects to SDF).

 

This UI command exports the Geometry and some other useful attributes like - InsideDia, OtsideDia, Length, slope etc.

 

Once the SDF is connected using FDO provider you can use the Expression builder and use the "Geometry" property to create a custom calculation.

 

Does it help ?



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Valued Contributor
raghulan
Posts: 92
Registered: ‎01-11-2012
Message 7 of 11 (502 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-26-2012 09:24 PM in reply to: raghulan

Thank Partha for the info.

Now I changed the course ...I am creating the SDF using the standard tool from C3D and then I wrote some code to create additional property defnitions under each featureclass..

 

then another code to insert/update value to the appropriate property defnition.

 

I am stuck at the point where my code to insert/ udpate doesnt seem to work.

 

Is there any example for code sinpet in C# to insert/ update value to the desiered coloumn and row in a feature class.

 

While inserting/ updating i want the code to choose the appropriate feature class (eg: pipe) and then column or property defnition (eg: lets say associated surface - custom added property - string data type) and check the pipe name (row) and add value.!!

 

please assist.

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 8 of 11 (493 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-27-2012 03:32 AM in reply to: raghulan

Is there any example for code sinpet in C# to insert/ update value to the desiered coloumn and row in a feature class.

 

>>> Did you check the following blog post ?


http://adndevblog.typepad.com/infrastructure/2012/05/how-to-modify-update-feature-attribute-using-ap...

 

Does it help ?



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Valued Contributor
raghulan
Posts: 92
Registered: ‎01-11-2012
Message 9 of 11 (488 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

09-27-2012 05:36 PM in reply to: Partha.Sarkar

Partha, 

 

 I checked that, my code is derived from that one and other the MAP3D developer Guide example and anothero one I found from OSGEO documentation.

 

But the problem is the code explains how to insert update data located in a layer.

in my case I have a SDF file and the SDF file I have feature classes (pipes, roads, alignments, etc) with that I have property defnitions (id, radious, starting point ,etc)

also there may be multiple pipes available (P1, P2, p3)

 

Now I want to go in to the desired feature class (eg: pipe)

then to the appropriate property defnition(eg: Associated surface - which already created in the schema)

and then I have go the row (pipe - p2) and update the value of the Associated surface for pipe p2 to the desiered value...

 

Any help would be appreciated. !!

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
Valued Contributor
raghulan
Posts: 92
Registered: ‎01-11-2012
Message 10 of 11 (458 Views)

Re: Civil3D pipe Road Data to SDF (GIS) Export using .NET C#

10-10-2012 10:09 PM in reply to: Partha.Sarkar

some more information

===================

 

My schema Structure (SDF File) 
==================================================== 
Schema name: Civil_schema 
Feature classes : Pipes, structure, point, ... 
properties inside Pipes feature class : PipeRadius, PipeType,.... 

==================================================== 
Now that I have the schema, I have two pipe data inside (two rows - PipeName = p1 and p2) 
I want to insert PipeType as Iron for R-1P1 and PVC for R-1P2 

for some reason my insert and update command isnt working... 


Code snippet 
==================================================== 

//static sdf file 
string sdffile = "c:\test.sdf"; 

//created a IConnection con (i have this in correct - just dont want to write all) 

using(con) 

    using (osgeo_command.Feature.IUpdate update_data =                 con.CreateCommand(osgeo_command.CommandType.CommandType_Update) as osgeo_command.Feature.IUpdate) 
       { 
            //set the target schema 
            update_data.SetFeatureClassName("Civil_schema: Pipes"); //schema name:clas name = this worked for reading 
            update_data.SetFilter("Name = R-1P1"); // this is to identify the row - i am not going to update this row 

            // property value collection 
            PropertyValueCollection pcoll = update_data.PropertyValues; 

            //creating a property value that needs to be added 
             PropertyValue propvalue = null; 
             propvalue = new PropertyValue(); 

             ValueExpression expression = (ValueExpression)Expression.Parse("'Iron'"); //want to add iron as my pipe type 

            propvalue = new PropertyValue("Pipetype", expression);//here i am specifying the column name as Pipetype 

            pcoll.Add(propvalue); 

             if (1 != update_data.Execute()) 
                    { 
                        ed.WriteMessage("\nUpdate failed");//this writes the message in autocad 
                    } 

       } 


============================================================== 
I dont know where i am going wrong...could you guys point me the correct direction please.. 

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.