MoI discussion forum
MoI discussion forum

Full Version: Script to load image

Show messages: All  1-4  5-9

From: Michael Gibson
31 Aug 2017   [#5] In reply to [#1]
Hi track, I think it should be possible to do a scripted load of background images, but like Brian writes above it would also need to decide the placement of the image - what plane it's on and its bottom left and top right corners. How would you want the script to handle those parts?

- Michael
From: track
1 Sep 2017   [#6] In reply to [#5]
I succeeded to place an image in a given position in 3D with the property frame of the image object.
I will look at the script mentioned above
From: Michael Gibson
1 Sep 2017   [#7] In reply to [#6]
Hi track, the function AddImage() in commands\Image.js is how MoI's image command creates new images. But it's a little complicated since all the UI and pointpicker bindings and such are in there as well.

Here's a streamlined example that just uses some fixed parameters:

code:
    var filename = 'c:\\img\\test.jpg';
    var baseframe = moi.vectorMath.createTopFrame();
    var cornerpt = moi.vectorMath.createPoint(20,20,0);

    var factory = moi.command.createFactory( 'backgroundimage' );

    // background image factory has 3 inputs:
    // 0 : String - FileName
    // 1 : CoordinateFrame - Plane that gives orientation of bottom-left corner of image
    // 2 : Point - upper-right corner point.

    factory.setInput( 0, filename );
    factory.setInput( 1, baseframe );
    factory.setInput( 2, cornerpt );

    factory.commit();


Hope that helps!

- Michael

Message 8571.8 was deleted


From: track
6 Sep 2017   [#9] In reply to [#7]
Thanks
It works

Show messages: All  1-4  5-9