Help making copied arrays with distinct attributes for each copy

,

I know I’ve seen this somewhere, but now I can’t find it-

I’m creating a component that essentially begins as a single column and adds columns to sort of snake along. It will have “buttons” that the user interacts with to choose which direction and orientation the next section of snake takes.

If I remember right, the other solution somehow stored and/or added up the prior changes in movement and rotation within the copy. I know this is vague, but I also believe it’s possible.

Thanks!
BT

yes, I believe its possible. something along these lines, needs more refinement

direction copy.skp (34.7 KB)

will continue with the improvements monday night, if you don’t finish it yourself

This taught me something new (to me) about Dynamic Components: That you can have more than one OnClick action! I’ll have to ponder the possibilities …

This is brilliant, though I’m still figuring out exactly how. Thank you thank you!

Trying to apply what you’ve shown to my component. Does the ONCLICK function do each operation’s calculation sequentially or simultaneously? I can’t tell if you’re leveraging that

I’m currently trying to figure out how to add up my list of angles and distances to create gradual arcs of cumulated X,Y,& RotZ (angle) values. Lots of Pythagorean geometry to do

I think I see (someone correct me if I’m wrong)- in a set of actions, a semicolon “;” separates sequential tasks and a comma “,” separates simultaneous actions?

Another question regarding your use of the “find” command:

=find(“,”,direct_record,copy+4)
(direct_record example: 0.0,-45,0.0,45.,45.,0.0,)

What does the search for “,” point to? And does the count go by digits or by CSVs?
There must be some significance to your 3-digit number system (“-45”,“0.0”,“45.”)?

Hi

the “,” is a delimiter to separate the data, it could be “_” or any other string. The “find” must find the delimiter string otherwise it returns an error. There are no error capture abilities in DCs, so one must assure one gets a true return.

so pos, the result of the find, gives the placement of the delimiter
I could use another delimiter to return the place at the end of the required record item, but I choose to set the record item string to a fixed length of 3, so as to simplify the code
your post quoted code corrected
( example: 0.0,-45,0.0,45.,45.,0.0,)
being strings of 3 separated by a comma delimiter, the comma included at end

In regards to the flow of the onclick, semicolon is use in all the separated actions there is no comma between them. Set is an immediate action, animate is the timed one. Later if require one could use animate to set up a time line to trigger various actions like most movie editors.

Given that the copy action you require is possible, your development of an algorithm for the turn movement should be the priority. Could you consider the leading bar and direction arrows as one component with a separate bar underneath to produce the trail. The copies of this separate bar would read the record of the leading component, thus making easier to just figure the required movement of just one leader

as per example attached (could have option to decide on turn rate,etc) copy function not included

direction copy2.skp (45.9 KB)

I’ve been taking this one apart, too, and they’re both extremely helpful. I’m slowly formulating the bones of my component.

For the “pos” find function, you’re saying it’s only to check that all dimensions have a length of 3? What would have to change in order to accommodate any string length?

I’m attaching my scratchpad of notes in case it helps clarify

what I’m trying to do

incorporating another delimiter to the data string to locate each record would work for undetermined record sizes

something like record = “copy0(0,0,0)copy1(2.5,53.369,90)copy2(15,-56.222,0.5)” which can be built using the set method upon an action

first find the string “copy” & copy, then use that position plus 1, to find pos1 “(” then from there the position of “(” plus one can find pos2 “)”
then this_record =mid(record,pos1+1,pos2-pos1-1)
then you use the comma delimiter to separate the data to the required field

in regards the position change, you could use polar coordinates, a set distance (option to change) * cos or sin of angle (option to change)

ie for stepping distance of dist=10, and a angle of Z_rotation
x = distcos(RotZ)
y=dist
sin(RotZ)
as per your calculations

its recommended that the DC axis is center to the bar object, so acts as a point, without the worry of the bar size (which can be another option to change)

the animation of RotZ would be determined by the directions adding, taking or none of angle change nominated.

attached example requires more work, the information is not transferred directly to the copy bar, can’t pass the data without a redraw. click on the first bar triggers redraw. However serves as an example to how the data string is created and used.

direction copy3.skp (48.7 KB)

Will return to the first model where the trigger and copy are one same level and update immediately. The negitive movement is incorrect, so needs work as well.

Well the errors in direction copy3 bugged me, the logic in the movement was correct, so investigated

first the " " on some of the set attributes was missing, fixed and the leader worked

next the copies on redraw from the passed data, for some reason the negative data was giving a zero result. Well that turn out to be the result of me changing the attribute type to inches for distances x, y and number for rotation. Yes there is a warning, but I thought I knew better. So started fresh with these attributes and using an intermediate attribute fixed that

So attached is number 4, added options to front component for step and angle. The copy to show the path works on redraw by clicking the first bar left behind (original) so for this example. create a path, then after 4-10, click the one at the beginning, can continue, but only the first mentioned bar updates all. So can continue with some guide from that produced.

Now concerning the first sample, it slows down too quickly as copies are produced with each move, so I leave that for now, until I get another idea, So will leave you with copy4, and hope you may work out a quicker solution for putting all the actions on same level.

cheers
Philip

direction copy4.skp (56.2 KB)

This is excellent, thank you again. I’m dissecting these almost as quickly as you’re updating; hopefully I can find a way to update these without redrawing the original. If not this is still great.

I’m most pleased to now understand that I can combine strings using the “&” symbol instead of CONCATENATE() and how to get more out of the MID() and FIND() commands. I’ve been avoiding text strings for the longest time, but they have some real value.

Will update when I can