Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Limiting Range Of Parameter Arrays

Anonymous
Not applicable
Hi all,
I am trying to figure out how to create a limit range for an object with parameter arrays, using a loop.
basically it is just a grid with adjustable grid line lengths controlled by loops:

for i = 1 to nGridLines
add2 gridLineX, 0
gosub “Grid Line”
del 1
next i

however i want to limit the minimum & maximum spacing for the grid spacing:
this is what i would do if it was not an array:

VALUES "gridXPosition" Range [1, 5]

Help me please!

Thank you
33 REPLIES 33
Ralph Wessel
Mentor
Braza wrote:
Within those 3d hotspots I've created an array parameter called "NodeHeight" and defined it in the parameter list as "NodeHeith[50]"...
The thing is: Am I limited with this 50 instances or can I control it with a specific Dim NodeHeight[] script?...
And of course creating a dynamic (unlimited) number of editable 3d hotspots...
You're not limited to the 50 instances - just add as many rows as you need using the script I showed earlier. Every time you use the parameters statement on an array parameter - referencing an index beyond the array bounds - the array dynamically expands as required. No temporary array is needed.

Refer to the attached image showing some examples of the Modular Joinery object. Every joinery unit, including the large curtain-wall in the background, is a single instance of the same object. Although it starts with enough storage space for just one window, it can expand indefinitely. Each frame can also have a completely different arrangement of frames, windows, doors, and panels hierarchically nested within it (and any arrangement of panes can be nested within any door or window). Every row/column has hotspots for dynamic stretching, but the object only allocates sufficient space for the specified object.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Thanks Piotr and Ralph.

I'll try it later.
Karl Ottenstein
Moderator
Thanks for the excellent examples and explanations, Ralph!

Cheers,
Karl
One of the forum moderators
AC 28 USA and earlier   •   macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Ralph,

I've just tested your tip and it works like a charm!

I've seen the light!... I can drag out the big smile on my face...

I vote this tip as the tip of the decade.

Thank you very much for sharing your knowledge!

p.s.: Just to check: It seems that arrays are dynamic, but they are not "Elastic"... once I expand it I can't shrink it, right?
Ralph Wessel
Mentor
Braza wrote:
Just to check: It seems that arrays are dynamic, but they are not "Elastic"... once I expand it I can't shrink it, right?
Correct. GDL doesn't (yet) provide a mechanism to reclaim space once it has been allocated. However, given that this is isolated to single instances of the object, I don't see it as a significant problem.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Ralph wrote:
Correct. GDL doesn't (yet) provide a mechanism to reclaim space once it has been allocated...
This one would be nice for AC14. 😉
Anonymous
Not applicable
Thanks a lot for these explanations, that's great!
ztaskai
Graphisoft Alumni
Graphisoft Alumni
What a nice conversation developed while I wasn't watching:)

I guess we should add some recommendations to the GDL Technical Standards about handling array parameters... I create a task for it right now!

About shrinking arrays: you can do this using a temporary array. A workaround - I know. I don't think we will provide a GDL command for this in the near future; definitely not in AC14.

Regs,
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Anonymous
Not applicable
Hi Zsolt,
ztaskai wrote:
...About shrinking arrays: you can do this using a temporary array. A workaround - I know...
I'm very interested in this... Could you please show a sample code with your workaround?... Does this workaround has any cons?
Anonymous
Not applicable
Hello all,
as we are in a interesting discussion I'd like to ask one more thing:
In the case of a complicate and heavy object with 3 nested macro calls, does the passing of big array parameters through subobjects make the objects slowlier?
I mean that if you have ten arrays of [50][150] in the first objects and you pass them to the first macro and then to the nested second macro, does such operations take more memory and time than if you would try to limit the arrays passed to the subobjects?
(like 10 items of one dim array of [150] instead of 10 items of [50][150] )

Maybe the question could be:
When you pass a parameter to objects, is a new memory holder used each time or is it the same one?

Hope I'm clear enough

Thanks in advance,
Olivier