# Constructing-an-Array-of-Polyline-Points

Constructing an Array of Polyline Points

# Constructing an Array of Polyline Points

The last issue to deal with is how to transform the individual point variablesâ€”p1, p2, p3, and p4â€”into the format required for the vla-addLightweightpolyline function. First, get some help on the topic.

## To obtain information on a function

1. Click the Help button on the Visual LISP toolbar. 2. Enter vla-addLightweightpolyline in the Enter Item Name dialog box, and click OK. (The Help system is not case sensitive,
so do not worry about how you capitalize the function name.)

Help states that AddLightWeightPolyline requires you to specify the polyline vertices as an array of doubles in the form
of a variant. Here is how Help describes this parameter:

`The array of 2D WCS coordinates specifying the vertices of the polyline. At least two points (four elements) are required for constructing a lightweight polyline. The array size must be a multiple of 2.`

A variant is an ActiveX construct that serves as a container for various types of
data. Strings, integers, and arrays can all be represented by variants. The variant
stores data along with the information identifying the data.

So far, you have four points, each in the format (x, y, z). The challenge is to convert
these four points into a list of the following form:

`(x1 y1 x2 y2 x3 y3 x4 y4)`

The append function takes multiple lists and concatenates them. To create a list of the four
points in the proper format for the ActiveX function, you can use the following expression:

```(setq polypoints (append (3dPoint-2dPoint p1)
(3dPoint-2dPoint p2)
(3dPoint-2dPoint p3)
(3dPoint-2dPoint p4)))```

Writing the 3dPoint-2dPoint function four times is a bit cumbersome. You can reduce the code further by using
the mapcar and apply functions. When selected, mapcar executes a function on individual elements in one or more lists, and apply passes a list of arguments to the specified function. The resulting code looks like
the following:

```(setq polypoints (apply 'append (mapcar '3dPoint-2dPoint
(list p1 p2 p3 p4))))```

Before the call to mapcar, the list of points is in this form:

`((x1 y1 z1) (x2 y2 z2) (x3 y3 z3) (x4 y4 z4))`

After mapcar you have a list of points in the following form:

`((x1 y1) (x2 y2) (x3 y3) (x4 y4))`

And finally, after applying the append function on the list returned from mapcar, you end up with the following:

`(x1 y1 x2 y2 x3 y3 x4 y4)`

>Constructing an Array of Polyline Points. Help. Applies to AutoCAD 2016, AutoCAD Architecture 2016, AutoCAD Civil 3D 2016, AutoCAD Electrical 2016, …coordinates are stored in an NSArray as NSValue objects, you can do … this is going bit complex, So i moved for creating poly line , where i input my coordinates array, and trying to create the poly line View.Arraylist of Point reference parameter. The Syntax … values and the number of points. There is no line drawing method that takes Point objects, you have to create int arrays of coordinates.Polyline (as it looks like you are trying to … create an empty array: var flightPlanCoordinates = [];.Create an Array of Points Arrays in Visual Basic … is that I need to draw lots of different polylines and polygons from dozens of arrays.array … Does each array also have a unique ID … Yes, every array's first index is …array.add(point) # Create a Polyline object based on the array of points polyline = arcpy.Polyline(array) # Clear the array for future use …coordinates of rhino tracks, #extracts the locations and adds pairs of coordinates to a polyline as an array #to be …Constructs a polygon at a specified distance from the geometry. … Returns an array of point objects for a particular part of geometry or an array containing a …

﻿﻿