After spending an hour or two trying to get AssignPresetName script to work with MoI4 and MoI5beta, I finally downloaded Pilou's French version, which worked just fine.
Then the versions I had struggled with, starting working. I wonder if there is some sort of Caching going on with my computer? I also think that Microsoft oneDrive perhaps should not be used while working on scripts? There is a several minute delay between work and home computers updating saved script versions.
Yesterday I had to replace the cmos battery in the computer at home. The clock kept stopping, and files were back-time dated, at home. And once, the improper time prevented logon to MoI forum.
Next came naming an object in a script.
Name that point, (and style it RED):
code:
function CreatePoint( xValue, yValue, zValue, ptName )
{
var pt = moi.vectorMath.createPoint( xValue, yValue, zValue );
var factory = moi.command.createFactory( 'point' );
factory.setInput( 0, pt );
var ptObj = factory.calculate();
if ( !ptObj )
return false;
ptObj.setProperty( 'name', ptName ); // Name the point.
var point = ptObj.item(0);
var g_style_index = 1;// This Style MAY be red.
point.styleIndex = g_style_index;
// All the points created ended up Style RED.
return point;
}
// Create pointA
var xValue = 1;
var yValue = 2;
var zValue = 0;
var ptName = 'pointA';
var pointA = CreatePoint( xValue, yValue, zValue, ptName );
moi.geometryDatabase.addObject( pointA );
The Style code was just a lark, and different Styles could be fed to the subroutine function.
- Brian
I suppose there is some way to script assigning an object to a group...
|