Anyone wish to develop a custom script?

 From:  Michael Gibson
4801.108 In reply to 4801.106 
Hi Brian,

> Created one object list by: var arc1List = arcFactory1.calculate();
> Created second object by: var arc2List = arcFactory2.calculate();
>
> How is it possible to combine the two lists into one list, with the two arcs in it?

An object list has a method addObject( obj ) that you can call to add the given object to the end of the list.

And you can retrieve an object from a list by using the item( index ) method.

So what you are talking about would be something like (assuming each has 1 object in it currently):

arc1List.addObject( arc2List.item(0) );



> Or create one list in some other script way?

You could also create a completely new list by calling moi.geometryDatabase.createObjectList() and then add both arcs to it.


> I do not understand the difference between an Object, and the Object
> List created by a factory.calculate();

Well, an object list is a container that can hold multiple objects - since some geometry factories may generate multiple objects the .calculate() method cannot just return a single object since that would then not work for those kinds of factories that generate multiple outputs.

So in order to be consistent across any kind of use, the calculate() method always returns an object list, even if the output was only a single object like it often is in most of the draw-type commands. So in cases like that it's a list but it contains just 1 object which you can access using the .item() method on the object list.

That's one of the details that's kind of more complicated currently with the factory system being oriented towards working with a number of different commands, at some point in the future it is likely that I'll add some more kinds of geometry creation methods that will just pass all the different parameters to a creation function rather than setting up factory inputs like the current system - the factory input system is more oriented towards each different input being wired up to some kind of UI control.


Check out this previous post for a plug-in command that creates a couple of circles and intersects them to create a point - it sounds like that is pretty close to what you are trying to do currently:
http://moi3d.com/forum/index.php?webtag=MOI&msg=3832.15


- Michael