We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
Sunday
I am creating an algorithm for graphically adding/subtracting elements of an array (dim_xy[ ][ ]) using hotspots (from the hot_mnu[ ] array).
It seems to me that adding new elements to the dim_xy[ ][ ] array works OK:
😊
But removing elements from the dim_xy[ ][ ] array unfortunately does not work properly because the last removed element of the array is restored:
😕😕😕
I noticed that for removing an element from the dim_xy[ ][ ] array to work, I have to click a hotspot not related to the hotspots hot_mnu[ ] before removing, i.e. remove in two stages:
😎😕
Where is the error? Can someone help?
I am attaching HotspotMenuGsm.zip (Ac27)
Solved! Go to Solution.
Tuesday - last edited yesterday
planned goal achieved ! 😃
1 - identification of a dragged hotspot
2 - sample menu of VALUES{2} options connected to the hotspots
(and I also switched the hotmenu tables REAL>INTEGER and changed the names of variables according to my own concept; while dragging hotspots you just have to be careful to "hit" the INTEGER values 1,2,3,-1,-5 etc, because this algorithm is more focused on using the hotmenu than regular dragging)
Thank you very much AllanP and Pertti Paasky for your interest in the subject and substantive help 😃
😃😃😃😃😃😃
────────────────────────
Edit:
for the sake of order and to finish the topic I am attaching the source object developed by Pertti in which it is easy to add new hotspots (drag to the right) and remove hotspots (drag to the left); this object operates with add_remove[] and _add_remove[] arrays and REAL values.
Sunday
You can not remove the edited parameter.
Rather add one array element more than needeed and do not use it.
Sunday - last edited Sunday
@Pertti Paasky, any example ?
Monday - last edited Monday
Pertti's is suggesting that you increase your array size globally by 1 so that your array parameter is not deleting itself. I have not read the script, but is it that when n = -1 then dim_xy [ n-1 ] [ n-1 ], and when n = 1 then dim_xy [ n+1 ] [ n+1 ]? Given the suggestion, this would then become dim_xy [ n ] [ n ] and dim_xy [ n+2 ] [ n+2 ]
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
Monday - last edited yesterday by Barry Kelly
I think it's not about dim_xy[][], but hot_mnu[].
In the center of the circles are hostspots dim_xy[][] - it's a simple matter.
And on the circle are hotspots hot_mnu[]. This is of course a simple example of handling two arrays: dim_xy[][] with +/-REAL values and hot_mnu[] with +/-INTEGER values with a limited range of <-1/0/1>.
In the "add new/remove" processes, hotspots related to hot_mnu[] are used. And first changes are made to hot_mnu[], and only then dim_xy[][].
The main problem, it seems to me, is to identify which hotspot hot_mnu[] is used. For this purpose, I use a for...next loop checking in which row the hot_mnu[] value has changed, i.e. <>0. After finding such a row I can perform operations on the main dim_xy[][] array (delete the row or add a new one).
The problem is the order of scripts and various other operations and saving in the hot_idx (the number of the clicked hotspot from hot_mnu[]) and hot_idprocess (=-1/0/1) parameters, and after using them, zeroing these variables.
That's why I included the hot_reset parameter, which appears in 2D instead of hot_mnu[] and helps to reset hot_idx=0, hot_idprocess=0 ("Click to RESET and try again"), before reusing the hotspots hot_mnu[]. I know it's a "prosthesis" but I have no idea (and experience) how to get around the problem and whether it's even possible.
I tried to create hot_mnu[] one element larger than dim_xy[][] but I do not really understand the idea etc.
Monday
Monday
@Pertti Paasky,brilliant and simple! Thank you very much!
I also tried comparing the current and previous values to recognize the edited hotspot, e.g.
dx=add_remove[i]-_add_remove[i] !difference
but that was within one two-column array dim[current val][previous val]. Unfortunately, errors in another place discouraged me from further attempts.
OK, I'm now trying to convert your solution from REAL arrays to INT, so that it works like a menu, e.g.
VALUES{2} "add_remove" \
0,">>",
3,"any action...",
2,"any action...",
1,"add new",
-1,"remove",
-2,"remove all" etc...
I'm getting something but not yet satisfactory.
I would like to use such a quick handy hotmenu to e.g. copy/paste materials between different surfaces, e.g. my own add-on to Wall Accessory or create new cutouts/overlays etc.
Monday
Go ahead, gaba. I think it is ok to change to integers. In addition, my algorithm allows to multiply the same hotspot many times.
Monday - last edited yesterday by Barry Kelly
@Pertti Paasky wrote:
Go ahead, gaba. I think it is ok to change to integers. In addition, my algorithm allows to multiply the same hotspot many times.
Pertti, your algorithm is great for cloning hotspots!
But I think it has one special feature: it doesn't allow to clone the same (!) hotspot to the same (!) place (i.e. at the same distance) multiple times:
I added to your script zeroing the values in add_remove and _add_remove (after finishing adding a new one etc.) and shortening these arrays according to the number of dim_xy[][] elements, but it doesn't help.
In my opinion the problem lies somewhere in remembering the previous value of the hotspot and then comparing it with the new value (from dragging the hotspot).
That's why for now I don't know if I will implement this algorithm as a hotspot shortcut menu, where constant values and repeating integers 1,2,3... are used.
Because some hotspots will remember once selected INTEGER value (e.g. 1), and then unnecessarily remember it in both add_remove and _add_remove arrays. And then you need to somehow force reset/clear both arrays. Unless someone has an idea for that.
Monday - last edited yesterday by Barry Kelly
OK, I've come full circle and returned to my original algorithm, despite having to "double click" occasionally to reset the "hotspot memory".
For now, I find it easier to control and extend the VALUES{2} options as INTEGER.