It is possible to extract a polyline from a Featureline here is an example
Public Function PolylinefromFeatureline(ByVal Featureline As Civil.Land.DatabaseServices.FeatureLine) As Object
'Refer to this forum post
'http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/Polylines-from-Featureline/td-p/3313009
'http://msmvps.com/blogs/joacim/archive/2009/08/31/gettype-and-typeof-confusion.aspx
Dim cv As Curve = Featureline.BaseCurve
'The basecurve of a featureline can be a 3dpolyline, 2dpolyline or a curve
'check if the base curve is a 3dPolyline
If cv.GetType() Is GetType(Autodesk.AutoCAD.DatabaseServices.Polyline3d) Then
MsgBox("this is 3dpolyline")
End If
'check if the base curve is a Polyline
If cv.GetType() Is GetType(Autodesk.AutoCAD.DatabaseServices.Polyline) Then
MsgBox("this is polyline")
End If
'check if the base curve is a 2dPolyline
If cv.GetType() Is GetType(Autodesk.AutoCAD.DatabaseServices.Polyline2d) Then
MsgBox("this is 2dpolyline")
End If
'check if the base curve is a curve
If cv.GetType() Is GetType(Autodesk.AutoCAD.DatabaseServices.Curve) Then
MsgBox("this is a curve")
End If
Return cv
End Function
Thanks for this technical stuff.
ReplyDeleteCV Format
Hi Justin,
ReplyDeleteI would like to know if you have any ideas of expanding this code to actually list out the elements and coordinates for the feature line. Ideally, I need a vb.net program that will cycle through selected Civil 3D feature lines and list the coordinates, AND list whether the segment is a line or an arc.
I have tried to modify your code to achieve this without any luck. I cannot find any way to read coordinates directly of the feature line or its elements, and when you TRYCAST to 3DPolyline, you loose the curve information.
I would be happy with a 2 step process of converting the featureline to a 2DPolyline to determine the elements (lines or arcs) using the .GETBULGE method, then iterating through the feature line to get it's corresponding 3D coordinates.
I am truly stumped on this and anything you can add would be greatly appreciated
Thanks - Mike
Justin,
ReplyDeleteI forgot to add to my previous post that the feature lines are Autodesk.Civil.Land.DatabaseServices.FeatureLine and not the roadway. If you have any suggestions on how to get the coordinates and wheter the segments are lines or arcs, I would greatly appreciate it - Mike
Mike
ReplyDeleteNot sure how you do it, I think I have seen a blog post on it before some where but can not if it Chris has this one on setting elevation point maybe get the points is similar
Set Elevation Points here
http://blog.civil3dreminders.com/2010/03/set-elevation-points-on-feature-line.html
Maybe post in the autodesk Civil3d customisation forum and you normally get an answer quite quickly.
http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/bd-p/190