Saturday 10 March 2012

Extract Objects/Polylines from Featurelines Part 2

Rainy weekend so decided to update the previous code I posted here into a command that extracts the base object 3dpolyline or whatever and adds it to the drawing
Public Function GetPolylinefromFeatureline(ByVal Featureline As Civil.Land.DatabaseServices.FeatureLine) As Object 'Refer to this forum post from some background '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 Dim oPline As New Object '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") oPline = TryCast(cv, Polyline3d) 'oPline.ConvertToPolyType(Poly3dType.SimplePoly) Return oPline Else 'check if the base curve is a Polyline If cv.GetType() Is GetType(Autodesk.AutoCAD.DatabaseServices.Polyline) Then 'MsgBox("this is polyline") 'oPline = TryCast(cv, Polyline3d) oPline = cv Return oPline 'Dim oPline2d As Polyline = cv 'Dim oPline2dx As Polyline2d = oPline2d.ConvertTo(True) 'oPline2dx.ConvertToPolyType(Poly3dType.SimplePoly) Else 'check if the base curve is a 2dPolyline If cv.GetType() Is GetType(Autodesk.AutoCAD.DatabaseServices.Polyline2d) Then 'MsgBox("this is 2dpolyline") oPline = TryCast(cv, Polyline3d) Else 'check if the base curve is a curve If cv.GetType() Is GetType(Autodesk.AutoCAD.DatabaseServices.Curve) Then MsgBox("this is a curve") oPline = TryCast(cv, Polyline3d) Else MsgBox("object of type " & cv.GetType().ToString & "not progammed for yet") End If End If End If End If Return oPline End Function









Unable to display content. Adobe Flash is required.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...