BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

[SOLVED] Rotate placement

Anonymous
Not applicable
This will be hard to explain, hope it makes sense.

When i place object it has defined x, y, z position. So when i need to place in different angle. For example if i rotate 90° i need y= to be x and x= to be y. It get's even more complicated when i need to rotate 45°.
So object get's placed in right position when placed in different angle.
Is there any useful functions to assist this?
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

yes, Geometry module helps with this kind of calculations.
You can use TMRotatePoint for example to rotate a point with an angle:
#include "Point3DData.h" // you need Geometry modul 
 
void RotatePoint (const Vector3D& origo, const Vector3D& axis, double angleDEG, double* x, double* y, double* z) 
{ 
	Geometry::TMRotatePoint (origo.x, origo.y, origo.z, 
								axis.x, axis.y, axis.z, 
								angleDEG * DEGRAD, 
								x, y, z); 
} 
 
// Usage: 
RotatePoint (Vector3D (0.0, 0.0, 0.0), Vector3D (0.0, 0.0, 1.0), 45.0, &x, &y, &z);


This example rotates the coordinates around the Z axis with 45 degrees.

Regards,
Tibor
Anonymous
Not applicable
Thanks Tibor.

Couldn't find solution calculated each >0>90>180>360 section coordinates, , long code...

And this takes just few rows Thanks.

Will change to this now.
Learn and get certified!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!