unearthed Posted April 27, 2014 Share Posted April 27, 2014 (edited) I have a range of symbols which are all hexagons of the same size (image). The contents differ, in this case being gradients, but they could be full of circles of different diameters representing plants (image). I want to rotate the hexagon symbols randomly. is this possible with vectorscript? Has anyone does anything similar? And would there may a way of having rule control on which faces can touch others? FWIW the project these are coming out of will have circa 400 hexagons. Edited April 27, 2014 by nig Quote Link to comment
michaelk Posted April 27, 2014 Share Posted April 27, 2014 Very possible This script will look for all the symbols named 'HEX' and rotate them around the insertion point of each symbol either 0,1,2,3,4 or 5 * 60 degrees. I'll attach an example file. hth mk Procedure RandomRotate; {Badly scripted by Michael Klaers} {April, 2014} {? 2014, Small Group, Inc - Michael Klaers michaelk@verysmallgroup.com} {Licensed under the GNU Lesser General Public License} {Gets all the symbols named 'HEX' and rotates them by random (0-5) multiples of 60 degrees} VAR SymbolHandle : Handle; {Handle to Symbol} RandomNum : Integer; xLoc, yLoc : Real; PROCEDURE SpinBySixty(SymbolHandle:HANDLE); BEGIN RandomNum := (((Random *10) / 2) DIV 1); GetSymLoc(SymbolHandle, xLoc, yLoc); HRotate(SymbolHandle, xLoc, yLoc, (RandomNum * 60) ); END; BEGIN ForEachObject(SpinBySixty, ((S='HEX'))); END; RUN(RandomRotate); Quote Link to comment
unearthed Posted April 27, 2014 Author Share Posted April 27, 2014 Hi Michael, Not so badly scripted - amazing, works very nicely and solves a big problem for me. I've enclosed my test file which has basic plant icons inside the hexagon symbol- the only problem I had was that I had to move the symbol insertion point to the centre of the symbol - before they were rotating off-centre. How I intend to use is this is guidance for the planting team - there's no money available for field supervision, and the planters won't be trained gardeners, so this way a semi-random planting scheme can be very explicitly laid out with minimal notes. Will probably GPS hexagon centres to assist setout. Quote Link to comment
michaelk Posted April 28, 2014 Share Posted April 28, 2014 I wrote it while I was supposed to be doing something else If I had another 15 minutes I would have had it get the name of a selected symbol and use the center of the object rather than the insertion point. Looks like you have it figured out, but let me know if you need more help. I enjoy procrastination. mk Quote Link to comment
Hippocode Posted April 28, 2014 Share Posted April 28, 2014 And would there may a way of having rule control on which faces can touch others? You could also load all of these symbols in an array and try to randomize them more according to your criteria. If with faces you mean segments (green touching red ) that would be harder as a script can't "see" how a gradient changes Quote Link to comment
unearthed Posted April 28, 2014 Author Share Posted April 28, 2014 What do you mean by 'load all of these symbols in an array'? Do you mean programmatically or in a physical array on the screen? Quote Link to comment
unearthed Posted April 29, 2014 Author Share Posted April 29, 2014 (edited) Procrastination time.... I intend to arrange the plants within the shape so that e.g. wetter tolerant plants are along say one face,, while say the opposite face was more drier tolerant species. Can the plugin be made so that wet faces don't end up adjacent to dry faces? I'm not sure if this is possible logically, let alone programmatically! The colour coded example shows this type of relationship, eg red is dry, blue is wet. The other mod would be a dropdown / or ability to select a new symbol name - possible or not? Edited April 29, 2014 by nig Quote Link to comment
Hippocode Posted April 29, 2014 Share Posted April 29, 2014 (edited) What do you mean by 'load all of these symbols in an array'? Do you mean programmatically or in a physical array on the screen? Programmatically. Afterwards you can choose to change rotation and position of some elements or just reprint the whole array physically. Procrastination time.... I intend to arrange the plants within the shape so that e.g. wetter tolerant plants are along say one face,, while say the opposite face was more drier tolerant species. Can the plugin be made so that wet faces don't end up adjacent to dry faces? I'm not sure if this is possible logically, let alone programmatically! Simply put you could create a structure array holding the handle, insertion point ,type and an array of handle of each adjacent for each hexagon.( multidimensional array if you want to work with rows and columns) From this point you can do some calculations on the order of elements and shift some based on your criteria. Most of it will work out but you'll stumble on impossible combinations. If 2 objects are adjacent its easy to rotate the 2nd one until it fits, but if that 2nd one has in total 6 around it you'll have make some choices.. Programmaticly you could manually assign a "degree ?" to a type of plant" (easy way) or you could work with subsymbols defining these The other mod would be a dropdown / or ability to select a new symbol name - possible or not? Not sure what you would like here, change all the symbols or just one ? Edited April 29, 2014 by hippothamus Quote Link to comment
unearthed Posted May 1, 2014 Author Share Posted May 1, 2014 Thanks Hippo I'm just absorbing this (also jobs keeping me busy too busy to think much on this - will come back in a week or so) Quote Link to comment
ford519 Posted March 15, 2018 Share Posted March 15, 2018 unearthing this post because I need a random rotator... would be a great tool to have but what would the script need to be able to input new SYMBOL/SYMBOL NAME? Thanks Quote Link to comment
Kevin McAllister Posted March 16, 2018 Share Posted March 16, 2018 3 hours ago, ford519 said: unearthing this post because I need a random rotator... would be a great tool to have but what would the script need to be able to input new SYMBOL/SYMBOL NAME? Thanks You might investigate Marionette and the Marionette forum. There were some examples of distributing symbols randomly. Kevin Quote Link to comment
AlanW Posted March 16, 2018 Share Posted March 16, 2018 Yes there is a random node and just link it with rotate Quote Link to comment
Pat Stanford Posted March 16, 2018 Share Posted March 16, 2018 Take a look at this thread for a possible solution. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.