Linear array + scale array All  1-20

 From: Samuel Zeller 12 Dec 2012  (1 of 20)
 Hi everyone, I'm trying to do a linear array where the space between each elements is increasing linearly. Let's say I got 5 cubes in a line, space between the first two cubes is 1, space between the second and third is 1.5, space between the third one and fourth is 2... and so on. I also want to do this kind of effect where the array is linear but the size change based on where the point is in the array. Btw it was done in Vectoraster on Osx. Attachments:

 From: Michael Gibson 12 Dec 2012  (2 of 20)
 5595.2 In reply to 5595.1 Hi DesuDeus, for the second one (change size based on position in array), there is a plug-in called ScaleArray which I think will do what you want: http://moi3d.com/forum/index.php?webtag=MOI&msg=275.109 The way you use it is you create an array using whatever array tool you want, for your case wanting a linear array you'd use ArrayDir. You need to include a point object along with the items to be arrayed, that point object will be used as the center of scaling. After you generate the array with center points included, then the ScaleArray plug-in can be used to do a changing scale operation on each array instance. I don't believe that there is anything currently set up to do the first spacing one that you are asking about though. - Michael

 From: bemfarmer 12 Dec 2012  (3 of 20)
 5595.3 In reply to 5595.1 More cool scripts to use and study! EDITED: 12 Dec 2012 by BEMFARMER

 From: Michael Gibson 12 Dec 2012  (4 of 20)
 5595.4 In reply to 5595.1 Hi DesuDeus, here's a new "ShiftArray" plug-in for doing something along the lines of the first one you were describing. You set it up in the same way as ScaleArray - include a point object with every array instance. In this case the point object isn't used as the center of anything, but it helps make it easier for the code to know how many array instances there are since there should be one point for every one. Then you pick a base point and an offset point, and instead of scaling it will move each instance with the first move based on the initial offset and then that offset is incremented for each successive item. So for example make a setup like this with a point object included with the array: Then running ShiftArray with an offset of 1 will produce this kind of result: That has lengths that go like so: Hope this helps! - Michael

 From: Michael Gibson 12 Dec 2012  (5 of 20)
 5595.5 In reply to 5595.4 Also it shifts in the direction from the base to the offset point (working like the Move command). So you'll want those 2 points to be in a horizontal line to get the kind of thing you were talking about. You can also shift in some other direction if you want, here's what happens with a vertical shift direction: - Michael Attachments:

 From: Samuel Zeller 12 Dec 2012  (6 of 20)
 5595.6 In reply to 5595.5 Awesome that's exactly what I needed ! Will test that :) It's for 2D work for Vifor pharma packagings, quite cool to work in MoI for some 2D parts. -- shapenoid.com stojan-voumard.com

 From: Frenchy Pilou (PILOU) 12 Dec 2012  (7 of 20)
 And a shift 'Fibonnacci" or logarithm one ? --- Pilou Is beautiful that please without concept! My Gallery

 From: BurrMan 12 Dec 2012  (8 of 20)
 5595.8 In reply to 5595.5 Hi Michael, If I ShiftArray a set, then Ctrl+Z to undo, then repeat ShiftArray with a right click, nothing happens. :o

 From: Michael Gibson 12 Dec 2012  (9 of 20)
 5595.9 In reply to 5595.8 Hi Burr, > If I ShiftArray a set, then Ctrl+Z to undo, then repeat ShiftArray > with a right click, nothing happens. :o Yeah the mechanism that it uses for recognizing the array instances is kind of fragile and depends on their order in the geometry database. If you do anything that happens to disturb this object ordering from the initial array creation then it won't work anymore. So you'll need to create the array fresh again in a case like that. Otherwise I might need to do something like have you manually pick every array instance separately in order to separately identify them, but that sounds pretty tedious if you have a big array... - Michael

 From: Michael Gibson 12 Dec 2012  (10 of 20)
 5595.10 In reply to 5595.7 Hi Pilou, > And a shift 'Fibonnacci" or logarithm one ? It's not set up to do that currently, but it should be possible to modify it to do such things. If you want to tweak it, look inside ShiftArray.js for line number 67 which has the specific code for applying the scale factor to the distance between the base and target points for shifting each item: code:``` Shift += i; Dir.scale( Shift ); ``` If you modify that it will modify the size of the shift of each item. - Michael

 From: Frenchy Pilou (PILOU) 12 Dec 2012  (11 of 20)
 5595.11 In reply to 5595.10 Perfect! --- Pilou Is beautiful that please without concept! My Gallery

 From: Samuel Zeller 13 Dec 2012  (12 of 20)
 Would it be possible to further work on this script to have a little input box like the scale array ? For input the size between items and maybe rotation and offset in 3 directions :D That kind of script is so useful :) -- shapenoid.com stojan-voumard.com

 From: Michael Gibson 13 Dec 2012  (13 of 20)
 5595.13 In reply to 5595.12 Hi DesuDeus, you can already control the distance - it's defined by the distance between the 2 points that you pick. If you need to enter in a specific distance just type in that distance value and push enter, that will activate "distance constraint" the same as when you're drawing a line. > For input the size between items and maybe rotation and offset in 3 directions :D If this kind of stuff is particularly useful, it may be time to learn how to do the scripting yourself - that way you'd be able to cook up whatever specialized tool that you need. If you want something that does movement, sizing and rotation, the previous Randomize command would might be a good place to start: http://moi3d.com/forum/index.php?webtag=MOI&msg=5416.5 That one incorporates all of moving, scaling, and rotation within it so it might be a good starting point to modify for whatever specific kind of transform tool that you need. - Michael

 From: Frenchy Pilou (PILOU) 13 Dec 2012  (14 of 20)
 Seems works not with a line like this, but yes if the different Objects + points are regularly spaced! does this normal? EDITED: 13 Dec 2012 by PILOU

 From: Michael Gibson 13 Dec 2012  (15 of 20)
 5595.15 In reply to 5595.14 Hi Pilou, > Seems works not with a line like this, but yes if the Objects + point are regulary spaced! > does this normal? Did you use one of the Transform > Array tools to create that sequence of objects? The way ScaleArray and ShiftArray are set up, they will only function on the output of one single array command - it looks like you have done things in some combination of steps to create that particular sequence, not just one single array. Either that or you have included multiple point objects with the array instances - there should be only one single point object per array instance for using ScaleArray or ShiftArray. - Michael

 From: Frenchy Pilou (PILOU) 13 Dec 2012  (16 of 20)
 5595.16 In reply to 5595.15 In fact that work if you draw objects like this :) Object a, Point a, Object B, Point B, etc...even irregularly spaced ! Then use the Array Dir :) Then ShiftArray Very cool! !) So my line above will works too! My error was to draw the points after the objects!!! EDITED: 13 Dec 2012 by PILOU

 From: Frenchy Pilou (PILOU) 13 Dec 2012  (17 of 20)
 :) --- Pilou Is beautiful that please without concept! My Gallery
 5595.18 In reply to 5595.12 Hi DesuDeus, here I've attached a kind of generalized array plug-in called ScriptArray, hopefully it may be of use for this kind of object generation. This version does not have any UI with it at all, you change parameters in it by editing the command script itself. This goes into the \commands sub-folder just like other commands, it's just that it won't show any UI in the upper-right area when it is running. Also note that MoI caches the contents of command files in memory the first time that it is run, so if you repeatedly edit the file you will need to either shut down and restart MoI on each run after an edit, or save to a new file like ScriptArray2.js, ScriptArray3.js, etc... In the next v3 beta there is a flag that you can set in moi.ini to turn off script caching though which will help with this kind of thing. With this version you edit the behavior by editing the code at the top of the script file. This version creates copies more like a regular array command, you do not need to create an array with point objects in it like the previous ScaleArray / ShiftArray commands. You control the number of copies generated by editing the line at the top that says: code:`var g_NumCopies = 40;` To control the spacing, scaling, and rotation there are 3 functions at the top of the file - UpdateMoveDeltas(), UpdateScaleFactors(), and UpdateRotateAngles() - these are called for each copy of the array and they are passed a point with .x .y .z values that can be modified, reset, randomized, calculated by some math forumla, ... whatever you want. Currently as a demo it's set up to make 40 copies, and it gradually increases the movement in x for the first 20 copies, then for the second 20 copies gradually reduces it. It increases scaling in x by 0.1 for each step for the first 20, after which it decreases x scaling and starts to increase y scaling, and it rotates around the z axis by an increasing increment of 10 degrees for each step up to 20 then decreasing it. This generates output like so: So this should help allow for whatever kind of array behavior that you can dream up, you can gradually increase and/or decrease different values, randomize just certain values, etc... hopefully it should serve as a template for generating all kinds of different array effects. Hope this helps! - Michael Attachments: