Rotation Matrix for Pick and Place application

Hello everyone,

I have a small task that I am currently unable to complete. I have a pick and place application of “blocks”. These are in a station and are all sorted and already assigned a fixed place.

My task is now to create a triangle from these blocks at a definable point. This means that I need a distance from this point that is the same in 3 directions. In addition, an angle is to be entered for this point (in the main file) so that this 3 blocks are placed rotated by this angle.

I thought of a rotation matrix as a solution, but I don’t know how I should/can implement it.

This should be written for a rutine, so that I can enter position and angle in the main file.

Part of my rutine at the moment:

rPlaceT_L_60_1(PERS robtarget pPlacePos, num nAnglePlacing, speeddata vPlaceing, PERS tooldata toGripperActual, PERS wobjdata wotableActual)
BasePoint_Refresh:=pPlacePos;
MoveJ Offs(RelTool(BasePoint_Refresh, 0, 0, 0 \Rz:= nAnglePlacing), 0, -49.39, 0),vPlacing, toGripperActual\WObj:=wobjtable;

For each block i have a seperate rutine, but this seems very very inefficient. And when i want to rotate the triangle, i have to “hard” code everything again.

Please give me some hints, help and suggestions.

Perhaps it is possible to place a coordinate system on a point that I can enter, from which the triangle is placed and I can also rotate the whole coordinate system? So I would enter the point (centre) and an angle around which the triangle should be placed. So the distances would be the same?

Picture
https://imgur.com/a/kTXlJMQ