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: 

2009: iterating FL points collection

2 REPLIES 2
Reply
Message 1 of 3
joshlund
204 Views, 2 Replies

2009: iterating FL points collection

I'm trying to use the aeccLandFeatureLine.GetPoints method to walk through the FL PI's and Elevation points but cannot seem to make it work. I'm assuming I should get a variant returned, correct?

Any suggestions or code samples?

Thanks,
Josh
2 REPLIES 2
Message 2 of 3
joshlund
in reply to: joshlund

here is what I have so far. . . When I place a watch on varPoints, it returns varPoints(0 to 20) of what appears to be coordinates (7 PIs on the FL). The problem is each value is a separate element in the array. For example varPoints(0) is the easting of hte first point and varpoints(1) is the norting. . . varPoints(3) starts the coords of a new PI. How do I break down the elements of the array to get coordinates triples?

Sub FLInfo()
On Error GoTo ErrLabel
If getCivilObjects = True Then
Dim objFL As AeccLandFeatureLine
Dim cFL As AeccLandFeatureLines


Set cFL = g_oAeccDb.Sites("Site 1").FeatureLines

Set objFL = cFL.Item(0)

Debug.Print objFL.ElevationPointsCount & " - ElevationPointsCount"
Debug.Print objFL.PointsCount & " - PointsCount"
Debug.Print objFL.Length3D & " - Length3D"
Debug.Print objFL.PIPointsCount & " - PIPointsCount"

Dim varPoints As Variant

varPoints = objFL.GetPoints(aeccLandFeatureLinePointPI)

End If
Exit Sub

ErrLabel: MsgBox Err.Description & " " & Err.Source

End Sub
Message 3 of 3
Anonymous
in reply to: joshlund

Josh, this is identical to how coordinates are returned for *Polylines.
Here's a quick example that works with any single dimension array. Pass the
listarray, the index(0 based) of the coordinate you want and the number of
items in the coordinate (a LWPoly returns them in XY whereas a 3dpoly &
FeatureLines return XYX)...For example, to get the fourth coordinate of a
XYZ list:

Dim vCoords As Variant
vCoords = oent.Coordinates

Dim testPt As Variant
testPt = GetCoordinates(vCoords, 3, 3)


[code]
Function GetCoordinatesFromArray(vCoordList As Variant, iIdx As Integer,
iXYZ As Integer) As Variant
Dim vPt() As Double
Dim iCtr As Integer
Dim I As Integer

iCtr = iIdx * iXYZ
ReDim vPt(0 To (iXYZ - 1))
For I = 0 To iXYZ - 1
vPt(I) = vCoordList(iCtr)
iCtr = iCtr + 1
Next
GetCoordinates = vPt
End Function
[/code]

"jlund" wrote in message news:5909920@discussion.autodesk.com...
> here is what I have so far. . . When I place a watch on varPoints, it
> returns varPoints(0 to 20) of what appears to be coordinates (7 PIs on the
> FL). The problem is each value is a separate element in the array. For
> example varPoints(0) is the easting of hte first point and varpoints(1) is
> the norting. . . varPoints(3) starts the coords of a new PI. How do I
> break down the elements of the array to get coordinates triples?
>
> Sub FLInfo()
> On Error GoTo ErrLabel
> If getCivilObjects = True Then
> Dim objFL As AeccLandFeatureLine
> Dim cFL As AeccLandFeatureLines
>
>
> Set cFL = g_oAeccDb.Sites("Site 1").FeatureLines
>
> Set objFL = cFL.Item(0)
>
> Debug.Print objFL.ElevationPointsCount & " - ElevationPointsCount"
> Debug.Print objFL.PointsCount & " - PointsCount"
> Debug.Print objFL.Length3D & " - Length3D"
> Debug.Print objFL.PIPointsCount & " - PIPointsCount"
>
> Dim varPoints As Variant
>
> varPoints = objFL.GetPoints(aeccLandFeatureLinePointPI)
>
> End If
> Exit Sub
>
> ErrLabel: MsgBox Err.Description & " " & Err.Source
>
> End Sub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report