GDL
About building parametric objects with GDL.

CONTROL OBJECT ROTATION VIA GDL

Nuge
Advocate
I want to control an objects rotation angle via GDL is it possible (ie i want to have a random rotation each time i place the object)

AC27 i9 11900K / 128G ram / GTX 3090 / D5 Render
2 REPLIES 2
Lingwisyer
Guru
	! +1    : fragments index start from -6
	! -1e-6 : to avoid exactly 12

rng_open_DIM = INT(RND(13)-1e-6) + 1
IF rng_open = 1 then
	gs_louvre_opening_angle = (gs_louvre_opening_angle_max - gs_louvre_opening_angle_min) / 12 * rng_open_dim + gs_louvre_opening_angle_min
endIF


I use those two lines in one of my window objects to randomise the lourvre rotation. You could try something similar. I am not sure which parameter you would have to update to change the floor plan rotation parameter you highlighted....



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Barry Kelly
Moderator
Yes you can control the rotation of an object in 2D with the ROT2 command.
Remember to make the same transformation in 3D with ROTx.

You can generate random angles (with the RND command) but I think you will have to do this in the Master Script so the same value can be used in both the 2D & 3D scripts.

I am not sure if the RND command generates truly random numbers or it repeats the same 'random' series every time it runs.
Search here and I am sure you will find information on it.

NOTE: you will not actually be changing the symbol rotation that you image shows.
You will still be placing the object with a 0° rotation - the script will add extra rotation.
The value you show in you image can only be manipulated by the user at placement of the object, or via API (add-on) scripting.


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