Show messages: All
1-7
8-11
From: Michael Gibson
Hi stefano, yeah it can be hard to read ones that have been condensed to one line for shortcut key pasting.
Here it's separated out:
moi.copyTextToClipboard( moi.geometryDatabase.notes );
var factory = moi.command.createFactory( 'annotationtext' );
factory.setInput( 0, moi.vectorMath.createTopFrame() ); <<<<<<<<<<<<<<<<
factory.setInput( 1, moi.geometryDatabase.notes );
factory.setInput( 2, 0 ); factory.update(); // Index of annotation property preset to use, 0 = "Default" preset values used.
var objs = factory.getCreatedObjects();
objs.setProperty( 'hidden', true );
objs.setProperty( 'name', 'Notes' );
factory.commit();
The line marked with <<<<<< is the one that sets the position.
moi.vectorMath.createTopFrame() will generate a coordinate frame object (made up of an origin point, and vectors for x,y,z axis directions) with world aligned x,y,z axes and origin at 0,0,0 by default.
If you wanted it to go at x=10, y=5 you could do it like this:
var frame = moi.vectorMath.createTopFrame();
frame.origin.x = 10;
frame.origin.y = 5;
factory.setInput( 0, frame );
- Michael
From: stefano (LIGHTWAVE)
Hi Michael the code looks very compact / efficient
So I think when you say
moi.vectorMath.createTopFrame() );
That means xyz = 0 and that expression = default position.
But if I wanted it to be less efficient with the code or longhand and see where to change xyz the values by code, I guess it is:
var frame = moi.vectorMath.createTopFrame();
frame.origin.x = 0;
frame.origin.y = 0;
factory.setInput( 0, frame );.
[where’s the z though ? is it in the empty () after Top Frame or is it in the set input ( 0, frame );
or can we have -
var frame = moi.vectorMath.createTopFrame();
frame.origin.x = 0;
frame.origin.y = 0;
frame.origin.z = 0;
factory.setInput( 0, frame );.
From: Michael Gibson
Hi stefano, yes that last one should work:
var frame = moi.vectorMath.createTopFrame();
frame.origin.x = 0;
frame.origin.y = 0;
frame.origin.z = 0;
factory.setInput( 0, frame );
- Michael
From: stefano (LIGHTWAVE)
Thanks again Michael. I’ve just moved my level of coding upwards from zx81, y0; Moi.factory.setitlikeapun);
Show messages: All
1-7
8-11