Orientation with Spreadsheet

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
lagunax
Posts: 55
Joined: Wed May 25, 2022 5:12 pm

Orientation with Spreadsheet

Post by lagunax »

Hi all.
Trying to look for info how rotation calculates here with (x,y,z,A - options in Orientation).
What i need:
i have body, that i need to rotate depends on 3 angles in spreadsheet (YAW(X,Z,bodyaxisX in scene))
Example:
is Spreadsheet:
---------------
| Y | A | W |
---------------
| 0 |90 | 45|
---------------
| result: |
---------------
| x | calculated |
| y | calculated |
| z | calculated |
| A | calculated |
---------------------

next cells will be used in body orientation for calculated values.

What i search:

How current calculation works? and how i can recalculate?

ps. tryin to search euler angles calculations, but can't figure out what kind of calculation used here. or may be someone show me what source file makes calculations in freecad.

pps, i don't need using menu or manualy write x,y,z,A or rotate using other drawing tools, because i need flexible calculation
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Orientation with Spreadsheet

Post by chrisb »

Hi and welcome to the forum!
lagunax wrote: Wed May 25, 2022 5:37 pm How current calculation works?
See Expressions on calculation possibilities
and how i can recalculate?
If it is not done automatically, click the Recompute icon.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
lagunax
Posts: 55
Joined: Wed May 25, 2022 5:12 pm

Re: Orientation with Spreadsheet

Post by lagunax »

chrisb wrote: Thu May 26, 2022 10:21 am Hi and welcome to the forum!
lagunax wrote: Wed May 25, 2022 5:37 pm How current calculation works?
See Expressions on calculation possibilities
and how i can recalculate?
If it is not done automatically, click the Recompute icon.
Hi, i know how spreedsheet works. i need calculation of rotation. in short, i have rotation scheme like ZYZ, or XZX with known angels, like (90,45,90) in YZY, i set those angles in spreedsheet and need to translate it into (Angle, axises(x,y,z))-form that i will use in body->Placement. how i can calculate this (Angle,x,y,z) matrix. i can't understand how FreeCad calculates Body position from them and how i can calculate from ZYZ(for example) into (A,x,y,z) form (it manualy able to do from Edit->Placement step by step, but i need to do this in spreedsheet).
also if i have current(A.x,y,z) - i need to recalculate it for ZYZ(for example) rotation with (90,45,90)angles (as example) and get new values for (A,x,y,z)
edwilliams16
Veteran
Posts: 3180
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Orientation with Spreadsheet

Post by edwilliams16 »

It's not clear what it is you don't know how to do. Spreadsheets support the creation of rotations and placements. They support the compounding of rotations eg rot = rot_yaw * rot_pitch * rot_roll

Here's a file with a spreadsheet, placing cubes with the same rotation computed directly or from yaw, pitch, roll separately.

https://wiki.freecadweb.org/Expressions#Create_function
https://wiki.freecadweb.org/Sandbox:Edw ... ler_Angles
Attachments
spreadsheetrotations.FCStd
(6.18 KiB) Downloaded 9 times
lagunax
Posts: 55
Joined: Wed May 25, 2022 5:12 pm

Re: Orientation with Spreadsheet

Post by lagunax »

strange file for me. i see functions, but do not see how it sets coordinates of cube. on cube properties-> placement Angle and axis do not linked to spreedsheet's cells and no macros there. in functions i do not see linkage with any cube. how it sets cube's placement data?
edwilliams16
Veteran
Posts: 3180
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Orientation with Spreadsheet

Post by edwilliams16 »

Right click on the Placement property and select Expressions. It shows the linkage to the spreadsheet alias.
Screen Shot 2022-05-26 at 9.15.57 AM.png
Screen Shot 2022-05-26 at 9.15.57 AM.png (60.74 KiB) Viewed 325 times

EDIT: You may want to pay attention to right click|show all in Properties - which shows stuff that is not normally useful to the casual user.
Last edited by edwilliams16 on Thu May 26, 2022 7:29 pm, edited 1 time in total.
lagunax
Posts: 55
Joined: Wed May 25, 2022 5:12 pm

Re: Orientation with Spreadsheet

Post by lagunax »

thanks, now i see.
for now i think this is best way to set rotations.
Post Reply