Script question about Points, Objects, vectorMath...

 From:  Michael Gibson
5194.2 In reply to 5194.1 
Hi Brian yes you're talking about 2 different kinds of "points" there.

One that you are creating by moi.vectorMath.createPoint() is a "data structure point" - it's a low level object that contains only an x,y,z value.

That kind of point is not a geometry database object that can go in an object list - object lists are built to contain geometry database objects, which have all kinds of various properties on them like styles, hidden states, object names, etc... The "point object" that you create by a pointfactory.calculate() is a geometry database object and can be put in an object list, it also contains x,y,z values but also in addition to that has all that other stuff for styles, object names, selection/hidden/locked states, etc... as well.

If you want to build an array you can use a Javascript array to do that, you don't necessarily need to use a MoI-specific object list which is a more specialized container that is only focused on holding geometry database objects.

You can get some tips on using general purpose Javascript arrays here:

The generic Javascript array can hold anything in it, not only just geometry database objects like the more specialized MoI object list container.

The most basic usage is to do something like:

// Create an array.
var my_point_array = new Array();

// Add things to it.
my_point_array.push( pt1 );
my_point_array.push( pt2 );
my_point_array.push( pt3 );

// Traverse the array
for ( var i = 0; i < my_point_array.length; ++i )
    var pt = my_point_array[i];
    ... do something with this point...

> to create 3D points, (which are apparently vectors),

Both points and vectors are made up of x,y,z coordinate triplets, so in practical use they can be represented with the same objects. It's just a matter of what you use the x,y,z data to do.

- Michael