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

Object placement

Anonymous
Not applicable
Hi!

I'm new to GDL scripting. Is it posible to make an object which finds other object from project and places itself in to it?

How could i get position from f.e. column wher to place GDL object ?
10 REPLIES 10
Anonymous
Not applicable
Hi.
first answer = No.
Each object sees only itself.
You can't code a chair to sense a table and put itself in position.
(But you can always code a special table and part of its code will be the chair near it.)

In other cases, if you code a door, for example, it will be positionable only on walls so second answer is "perhaps"

Barry Kelly
Moderator
New wrote:
I'm new to GDL scripting. Is it posible to make an object which finds other object from project and places itself in to it?
Objects can't recognise other objects or elements in your model.
However one object can 'CALL' another object.
This can be automatic (i.e. will happen every time) or you can add a Boolean (on/off) parameter to you object that allows you to manually call the second object.
New wrote:
How could i get position from f.e. column wher to place GDL object ?
You can add hotspots to you object and use these as anchor points for placing a set distance from your column.
The hotspot distance can be adjustable via a parameter in you object if you need an adjustable distance.


If you are new to GDL scripting then try googling 'GDL Cookbook'.
This is probably the best source for learning GDL scripting - even if it is a bit old now.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Thanks for help!

I do Appreciate.
Anonymous
Not applicable
Cadimage's electrical object reacts to adjacent walls, but is an addon. Didn't know one object could call another.. Is there an example of that somewhere Barry?
Barry Kelly
Moderator
hfs55 wrote:
Cadimage's electrical object reacts to adjacent walls, but is an addon. Didn't know one object could call another.. Is there an example of that somewhere Barry?
I can't give a good example with the standard Graphisoft library object as I don't use them.
But theire windows for example call in the frames, panels and sills - although these may not be items you can place individually.


But and example I can show you is my gable object.
I have a separate barge and finial objects that I can use on their own if needed but I simply CALL them into my gable object so I don't have to script them all over again.

When you call an object (or macro - generally this is a non place-able object or it could just be a series of instructions for determining brick coursing size for example) you can give it all the parameter values you need to make do just exactly what you want it to do.

Barry.
call.jpg
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Thanks for the example Barry. Still have a way to go till with Gdl...
Anonymous
Not applicable
Could there be more efficent way of getting coordinates of an object from project?

Maybe using GV, req, maybe macros.
I understand that with call i can only draw one or another object into each other, right? That way both objects would be like 1. hmmm...

Found it usefull in some cases, but the main problem is that i need to get data from project about object location and few other parameters, maybe export them to .txt file?

I belive addon would be right aproch but haven't been able to find soloution yet. Curently looking into Geometry functions and APINeig trying to figure out how do they work and if they can be usefull for my project.

Finding soloution in GDL scripting would be better.
Anonymous
Not applicable
Progress:

Using Global variables got object to some or another way to communicate with archicad project. But when i move object with script it doesn't move where i want and also symb_pos of and object doesn't move and weirdly move further away.

I guess Glob_user variable aren't really reliable. Is there a way to move symb_pos with scripts ? Coudln't get it to move.
Barry Kelly
Moderator
I am not sure exactly what you are trying to do.
SYM_POS with give you the co-ordinates of your object global origin in relation to the model origin.
You can not use these to move you object - that has to be done with the ADD command.
Movement commands (i.e. ADD, MUL, ROT) will have no effect on the SYM_POS values

You could have one object write the SYM_POS values to GLOB_USER variables or to an external text file.
You could then have second object read in those variables and use the ADD commands to move the object away from the Global Origin by that distance.
But you would always have to place the second object exactly on the Drawing Origin for it to work (at least I think it will - haven't tested to be sure).

The other problem you will have with GLOB_USER variables is that there is only a limited number of them.
So SYM_POS_X, _Y & _Z will use up 3 of them.
If you want more than one object reliant on the position of another you will fast run into trouble.
Text files may be better but I am sure they will still have their problems.

The second object you place will always be reliant on the first object being there and having written values to GLOB_USER or text file.
Possibly depending on where you script the saving of values in the first object will affect whether they get written or not (i.e. is the parameter or master script being run?).
Again I am only speculating as I don't know what you are trying to do.

If I need a second object to be reliant on the position of the first then I will just do a simple CALL statement in the first object and position the second object where it needs to go with ADD & ROT commands.
You can even add a Boolean (On/Off) switch to the first object to say if you want the second to show or not.
You could place as many of these objects as you like in your model and the would all work independent to each other - they will not all be trying to use the same GLOB_USER variables.

I hope this makes sense.
Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11