The script for chain

 From:  Michael Gibson
6087.47 In reply to 6087.41 
Hi Brian, so I looked into why Flow is not working, and one thing is for flow input index 1, the base curve that should be a curve object and not an object list, so these lines:

code:
	factory.setInput( 0, chainobj );
//	var baseline = baselineobj.item(0);
	factory.setInput( 1, baselineobj );
	factory.setInput( 2, targetCurve );


should have these 2 lines changed like this:

code:
	factory.setInput( 0, chainobj );
	var baseline = baselineobj.item(0);   // <<< enable this line that you tried before.
	factory.setInput( 1, baseline );       // <<< put in the curve, not the object list here.
	factory.setInput( 2, targetCurve );



But then there's an additional problem which is that the results from arraydir are not returned back to you - that's because of a mechanism in the array commands where during calls to .update(), they don't actually create full object copies and instead make a special lightweight "proxy" object (sort of like an instance) that can be constructed more quickly than an actual full object copy and so that keeps the display more interactive while doing some large number of arrayed items and placing points around. But it's messing up your script in this case because at the time the script calls getCreatedObjects() the system doesn't think any full objects have been created yet because of this special proxy object creation being done instead.

Proxy making is turned off when you do a .commit() but then also at that point the factory considers itself to be completely finished and clears its created object list at that time so you can't call .getCreatedObjects() at that time. Proxy generation is also turned off though if you call .calculate() so for now the solution will be to call .calculate() on the arraydir factory rather than update/getCreatedObjects/commit and also you'll need to add the results of calculate into the geometry database so they will work with the async flow factory.

So that means changing the array section from this:
code:
	var arrayfactory = moi.command.createFactory( 'arraydir' );
	arrayfactory.setInput( 0, linklist1 );
//	arrayfactory.setInput( 1, 5 );
	arrayfactory.setInput( 2, baseStartPt );
	arrayfactory.setInput( 3, offsetPt2 );
	arrayfactory.setInput( 4, baseExtentEndPt );
	arrayfactory.setInput( 5, "Offset, Extent" );
	arrayfactory.update();
	var chainobj = arrayfactory.getCreatedObjects();
//	var chain = chainobj.item(0);  This line does not help.
	arrayfactory.commit();
	factories.push( arrayfactory );	


To this instead:

code:
	var arrayfactory = moi.command.createFactory( 'arraydir' );
	arrayfactory.setInput( 0, linklist1 );
//	arrayfactory.setInput( 1, 5 );
	arrayfactory.setInput( 2, baseStartPt );
	arrayfactory.setInput( 3, offsetPt2 );
	arrayfactory.setInput( 4, baseExtentEndPt );
	arrayfactory.setInput( 5, "Offset, Extent" );
	var chainobj = arrayfactory.calculate();   // <<<<<
	moi.geometryDatabase.addObjects( chainobj ); // <<<<<


After those 2 changes then the flow part should work.

- Michael