Title: RE: MI Nodes in Polylines

> 1. Is it possible to get the number  of nodes in a Polyline?

Getting the number of nodes for a pline is found through ObjectInfo.

Dim bObject As Object
Dim nNumNodes As Integer

bObject = PolylineTable.Obj

nNumNodes = ObjectInfo(bObject, OBJ_INFO_NPNTS)

> 2. in the next step I would like to get the coordinates for all the nodes which are  > building a polyline.

Use the ObjectNodeX and ObjectNodeY commands to grab the x and y coordinates of the nodes.  You can use a counter to loop thru the polyline node by node.  It would also be helpful to check for plineness - ObjectInfo(bObject, OBJ_INFO_TYPE) - before the loop as I have found MapBasic to be a little tipsy with ObjectNode and a regular old line.

Dim Xcoord As Float
Dim Ycoord As Float

For nCntr = 1 To nNumNodes
        Xcoord = ObjectNodeX(bObject, 1, nCntr)
        Ycoord = ObjectNodeY(bObject, 1, nCntr)
Next           

Reply via email to