AutoCAD Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.

AutoCAD Civil 3D Customization

Post 1 of 15

Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

4405 Views, 14 Replies
11-29-2014 09:36 AM
I feel I speak for many when I say that the next version of Civil3D badly needs a comprehensive Managed .NET API.  While COM was hot stuff back in 1993 it's undesirable now.   For the moment we'll only discuss FeatureLines.
  1. Model the API after the AutoCAD Polyline object API, they really aren't that different.
  2. Include the ability to create a new FeatureLine, no hoops like COM AddFromPolyline.
  3. Include point manipulation tools like SetPointAt(Index), AddVertexAt(Index ...), RemoveVertexAt, etc.
  4. Include bulge manipulation like GetBulgeAt(Index) and SetBulgeAt(Index), see note below.
  5. Evaluate every method and property of the AutoCAD Polyline and Polyline3d API and if it applies, implement it.
  6. Make it fast, direct ARX wrappers, no COM.
To say that the current COM GetBulgeAt(Point) is inefficient is an understatement. This method requires the API to loop through the coordinates doing at least two precision comparisons (northing, easting) to determine the return value.  For example if the point is at the end of the FeatureLine it has to compare to all the points just to find it.  If you have a drawing with hundreds of long FeatureLines attempting to get all the bulges creates the appearance of an application lock up.
Sometimes I wish I was representing all US DOTs or the largest Civil3D user company so that requests like these didn't get swept under the rug as they have before.
Post 2 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

11-29-2014 12:48 PM in reply to: TerryDotson

More of a wish than a basic need, but a .CreateOffsets(Horz, Vert) method would be nice, returning an ObjectIdCollection of the results.

Post 3 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

12-04-2014 07:20 PM in reply to: TerryDotson
Thank you for the feedback, I've forwarded it to the engineering team. You are always welcome to send us feedback/suggestions to make our API more easy to use and with higher quality. Thank you again for your support!

Daniel Du
Developer Technical Services
Autodesk Developer Network

Post 4 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

02-07-2015 06:29 PM in reply to: Daniel.Du
Lets make the procram actually work.please change the laout tabs back to the arrow method. Get the basics solid first then fix the features!
Im frustrated regularily by all kinds of ticks that happen in civil 3d. I have reinstalled 3 times and the same things are NOT working.the last version i actually trusted was
2011.its a great program only when i dont have to work around terrible programming and changes for the sake of changes!
Fix laouts from moving, viewports that stick , new layers that work in the manager but dissapear. There are lots of these problematic issues.
Want a great idea- shorten xref paths to one folder so it doesnt matter what pc your on. Please dont suggest relative because it doesnt stick ( constantly have to readjust to relative)
Thank you
Post 5 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

02-08-2015 09:54 PM in reply to: TerryDotson

Terry, if only you had more say in Civil 3D strategic planning.


I have an off-topic question..

What is US DOT? Department of Transport? Drawing Office Technician?


Don't give up Terry, and thanks for all the fantastic support you provide to users all over the World.






Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

02-11-2015 05:48 PM in reply to: kevin.barnett

US DOT is Department of Transportation. Each State in the United States has their own DOT and they are able to choose which software they want to use. In order to get into the DOT market many of the new features of Civil 3D are related to that pursuit to the detriment of other types of work such as site development.

Civil Reminders
Post 7 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

02-11-2015 08:13 PM in reply to:

And .. there's another guy that makes Civil 3D life that little easier with his support .. Chris.. Thanks for the confirmation. Being in South Africa, I dont have a good grasp of how "it all works" in the US.


Now even more off-topic...


The company I work for have started to implement Project Wise. When I google-search for Project Wise I hit a lot of US DOT policies and manuals. Looks like Project Wise is the standard fo Document Management at US DOT offices.We are struggling to find a working method for using data shortcuts in Project Wise. At the moment we are still trying to use the Bentley integration method (zipped folder with unique file name so that apps can work that specific unique file). But it's not good. The shortcuts break easily and it takes ages to refresh project shortcuts before designers can do any CAD work.


Back to topic...


Autodesk have started to recognise people that go the extra mile, by giving them the Expert Elite status. It's time for Autodesk to take that Elite status one step further. To include people like Terry, Chris and Jeff in Civil 3D development planning sessions. Imagine how great the product would be...


Here's hoping you all have a blessed day / week / year / life ..




Post 8 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

02-12-2015 12:54 AM in reply to: kevin.barnett

I've forwarded this message to engineering team, your feedbacks are always valuable for us, thank you for that!


And thank you all for your efforts, it is your contributions keep the continuous prosperity of this community, thank you all and wish you have a good day and a good year.

Daniel Du
Developer Technical Services
Autodesk Developer Network

Post 9 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

03-31-2015 07:50 AM in reply to: TerryDotson

In a continuing effort to find workarounds for absences in the .NET API, a thought came to mind to use grip editing to change the vertices of a FeatureLine in code.  This code works and the vertices move, but an immediate UNDO command causes:


INTERNAL ERROR: !dbutil.cpp@487: eFileError


Admittedly this is my first time trying to use MoveGripPointsAt, is there anything wrong with this code.  To demonstrate actual moving it's simply trying to move the vertex up 10.0 x the index (my real test calculates the difference to new desired coordinates).


  <CommandMethod("FlVtxMove")> _
  Public Sub FlVtxMove()
    Dim SelOpt As New PromptEntityOptions(vbLf & "DS> Select FeatureLine: ")
    SelOpt.SetRejectMessage(vbLf & "DS> Selection Error !")
    SelOpt.AddAllowedClass(GetType(FeatureLine), True)
    Dim SelRes As PromptEntityResult = ActEdt.GetEntity(SelOpt)
    If SelRes.Status = PromptStatus.OK Then
      Dim SelOid As ObjectId = SelRes.ObjectId
      Dim DatBas As Database = Application.DocumentManager.MdiActiveDocument.Database
      Using TrnAct As Transaction = DatBas.TransactionManager.StartTransaction
        Dim FeaLin As FeatureLine = TrnAct.GetObject(SelOid, OpenMode.ForWrite)
        Dim PntCol As New Point3dCollection
        FeaLin.GetGripPoints(PntCol, New IntegerCollection, New IntegerCollection)
        Dim VtxInd As Integer = 0
        For Each PntLoc As Point3d In PntCol
          Dim VtxCol As New IntegerCollection
          Dim MovVec As Vector3d = New Vector3d(0.0, VtxInd * 10.0, 0.0)
          FeaLin.MoveGripPointsAt(VtxCol, MovVec)
          VtxInd += 1
      End Using
    End If
  End Sub



Post 10 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

04-01-2015 02:11 PM in reply to: TerryDotson
Your code is similar to what I would've tried, Terry. I'm not seeing any reason for this to be throwing that error and killing the session.
Jeff_M, also a frequent Swamper

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

04-03-2015 07:45 AM in reply to: Jeff_M

Not being able to edit the XY of anything inside an AutoCAD environment especially a feature line is like saying I can't walk. This is long overdue.


Post 12 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

04-09-2015 12:59 AM in reply to: DavidGarrigues5269

Thank you for the comment, I've submit a wishlist to engineerting team about this, engineerting team will evaluate this. Thank you for your understanding and patience. 

Daniel Du
Developer Technical Services
Autodesk Developer Network

Post 13 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

01-23-2017 07:11 AM in reply to: TerryDotson

In 16.2 some work was done on this but it falls short, especially in two areas (in order of importance).

1) Vertex editing still cannot be accomplished.  There is no SetPiPoint method and the combination of DeletePiPoint and InsertPiPoint cannot be used to change (all) the points.  Since there is no INDEX parameter on these they are of limited use anyway?  Please provide an example if I'm wrong.

2) You still cannot create a new FeatureLine.  The only method available is to create a database resident polyline (in a separate transaction) then convert it to a FeatureLine.  Perhaps an overload to the FeatureLine.Create function that accepts the Point Collection and optionally the bulge data?

Please, EDITING is EXTREMELY important to us and many, many others as I have discovered while trying to find a solution.  Perhaps the simplest thing (on Autodesk's part) would be a SetPoints companion to the GetPoints?

FL.SetPoints(PriCol, FeatureLinePointType.PIPoint)
FL.SetPoints(SecCol, FeatureLinePointType.ElevationPoint)

Please give us a decent way to edit a FeatureLine and please include this in a 2017 service pack also?

Post 14 of 15

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

02-02-2017 10:33 AM in reply to: TerryDotson

One thing to watch out for with the new .NET FeatureLine.Create function is that it appears to delete duplicate or invalid points during the creation of the FeatureLine.  For the latter invalid scenario imagine the user has closed the boundary improperly by picking the POB again to close the figure instead of using the (C)lose option.  This user drawing problem is not a new problem, goes way back.


In this scenario the API appears to return all the points in the FeaObj.GetPoints method and only the points it kept in the FeaObj.PIPointsCount value.  For example if the user had drawn a rectangle improperly, the FeaObj.GetPoints count is 5 while the FeaObj.PIPointsCount is 4.  So assume the PIPointsCount is correct, not the GetPoints count.


Sadly this was code that had to create a polyline then convert it because there is still no way to modify the vertices of an existing FeatureLine.

Re: Civil3D 2016 .NET API - Comprehensive FeatureLine Functionality

02-02-2017 11:43 AM in reply to: TerryDotson

I was wondering Terry if you could share your workflow on the process you are using? 


Here is the process I'm using:


  1. Store the PI and elevation point information of the feature line.
  2. Remove all elevation points.
  3. Get a polyline by GetProjectedCurve(). This results in either a Polyline2d or Polyline.
  4. Create new feature line.
  5. Set PI elevations and create elevation points.
  6. Delete old feature line.

In this process sometimes the feature line doesn't take all of the set points. It looks like now that I look at the list I might want to move step 6 before step 4. 


Also when a user does an undo it appears that the feature lines go down to zero and doesn't remember the previous elevation values. All of this is done under one transaction. I'm hoping I don't have to break this up into individual transactions to get this to work.

Civil Reminders
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post

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.