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

Rotation in 2d do not have any effect in the "Preview and p.

Anonymous
Not applicable
I have made an object. The 2d script works fine when the object is open.
The display in the Parameters shows a rotated 2d object as it should.
I put an instance of this object in the floorplan.
I watch the display in the "Preview and positioning" and put 45 degrees in the box, but no effect on the 2d symbol in the display.
I have deleted and reloaded the object in the Library Manager.
----
Also I used to be able to open an object when I selected an instance in floorplan, and pressed ctrl + O. But now I only open the filedialog with this command.

Maybe some connection between the problems?
10 REPLIES 10
Anonymous
Not applicable
I forgot that it was ctrl + Shift + O that opend the object description.
This works fine.
______________________
I hoped that a save and reload of the object would fix the first problem, but no. The rotation code i put into the 2d script still do not seem to have any effect for the 2d view of the object. But in 3d it works allright. So this is still a problem.
Barry Kelly
Moderator
Make sure you are using the correct command in 2D.
For 2D it is .... ROT2 angle
For 3D it is .... ROTx angle .... or .... ROTy angle .... or .... ROTz angle

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
I use ROT2 w~ in the 2d script. It works fine in the object description parameters. When I press the first button below the display the 2d drawing rotates allright. But not in Settings of the instance of the object I put in the floorplan. But I have saved and reloaded the object.
Barry Kelly
Moderator
The W~ is the old global variable name for SYMB_ROTANGLE.
SYMB_ROTANGLE is the value in the info box for the object rotation as you place it on plan.

If you want to use that to rotate your object then there is no need to script anything.
Just rotate the object as needed in the info box or object settings dialogue.

How ever if you want an object that can not be rotated then you can add ROT -W~ to your 2D script.
This is often just used for the text parts of an object so the text is always readable even when the object is rotated.

What you are doing in your object is rotating it by as much again as what you rotate the object by when changing the rotation angle in the info box.
ie 2 times the rotation angle (if 45° then you are rotating 90° which is possibly why you don't notice the change if your object is say a square).


If you want a user parameter for the object (or parts of it) then create an angle type parameter (ie rot_ang) and use this in the script.
ie ROT2 rot_ang

Not sure if I am helping or confusing you more?
If you can give us some more info on what you are trying to script then we can help some more.

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
This is the code in the 2d script of the object I've made.
The display in the Parameters behave as expected when I change the rotation angle. But the problem occurs in the instance of an object.

IF V~=0 THEN
ROT2 -W~
RECT2 -B/2,-A/2, B/2, A/2

PEN 20
HOTSPOT2 0,0
HOTSPOT2 -B/2, A/2
HOTSPOT2 B/2, A/2
HOTSPOT2 -B/2,-A/2
HOTSPOT2 B/2,-A/2
ENDIF
Anonymous
Not applicable
Here is the Preview an positioning for the object that shows that the object do not rotate when I change the angle.
2dScript.jpg
Laszlo Nagy
Community Admin
Community Admin
I would suggest that you not use the old V~ and W~ variables because they are there only for compatibility reasons.
Please replace V~ with SYMB_MIRRORED and replace W~ with SYMB_ROTANGLE and see if it works.
Also, note that V~ / SYMB_MIRRORED is checked for in the first line of the script so all the commands in this short script are executed only if the Object is not mirrored (the Mirrored checkbox is not checked in the Dialog).
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Aussie John
Newcomer
Since rotate is hardwired and doesnt need to be scripted when you add rot2 -W~ you are effectively adding and subtracting the same command and hence ending up in the same place. ie no rotation.

The code you use is useful to get text associated with a symbol to not rotate even thought the main object has been. (there are other issues with that concept but wont got there)
Cheers John
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019
[/size]
Barry Kelly
Moderator
Anne wrote:
This is the code in the 2d script of the object I've made.
The display in the Parameters behave as expected when I change the rotation angle. But the problem occurs in the instance of an object.

IF V~=0 THEN
ROT2 -W~
RECT2 -B/2,-A/2, B/2, A/2

PEN 20
HOTSPOT2 0,0
HOTSPOT2 -B/2, A/2
HOTSPOT2 B/2, A/2
HOTSPOT2 -B/2,-A/2
HOTSPOT2 B/2,-A/2
ENDIF
What your code is saying is -
IF V~=0 THEN If object is not mirrored
ROT2 -W~ Rotate by the negative of the rotation angle (ie undo the rotate)
RECT2 -B/2,-A/2, B/2, A/2 Draw a rectangle
PEN 20
HOTSPOT2 0,0 Add some hotspots
HOTSPOT2 -B/2, A/2
HOTSPOT2 B/2, A/2
HOTSPOT2 -B/2,-A/2
HOTSPOT2 B/2,-A/2
ENDIF
If object is mirrored then do nothing (no rectangle or hotspots).

If you want to stop an object from rotating then what you have works as you have found out.

If you want to stop an object from being mirrored then -
IF SYMB_MIRRORED = 1 THEN
MUL2 -1, 0
ENDIF
RECT2 -B/2,-A/2, B/2, A/2


You won't notice much happening though with just a rectangle.

Substitute the RECT2 command above with this to see what happens when you try to mirror.
set fill "Empty Fill"
poly2_b{3} 8, 3, 1, 0,
0, 0, 1, 0, 0, 1,
0, -0.1, 1,
0.5, -0.1, 1,
0.4896921399734, -0.3217339824516, 1,
0.8, 0, 1,
0.5, 0.3, 1,
0.5, 0.1, 1,
0, 0.1, 1,
0, -0.1, 1
hotspot2 0, -0.1
hotspot2 0.5, -0.1
hotspot2 0.4896921399734, -0.3217339824516
hotspot2 0.8, 0
hotspot2 0.5, 0.3
hotspot2 0.5, 0.1
hotspot2 0, 0.1
hotspot2 0, -0.1


It won't mirror.
Now comment out or delete the MUL2 command and it will mirror.

There is no need to add any rotate commands in your script if you are going to be using the object's rotation angle.
This is all handled automatically.

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