[SOLVED] What does it mean "Pos=(0,0,0)" ?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

[SOLVED] What does it mean "Pos=(0,0,0)" ?

Post by manos »

Hello

I run the sent2.py at the Box1.FCStd and the last line is:
"print(' Global Placement =',obj.getGlobalPlacement())".

And the response is:
"21:11:01 Global Placement = Placement [Pos=(0,0,0), Yaw-Pitch-Roll=(0,0,0)]"

So the question -obvious to me - is: What is at (Global) Pos=(0,0,0) ? It seems that any point of the pad is far from those coordinates.
I am afraid that I am again at square 1.
So what is the meaning of Global Placement Pos ?
Thanks in advance.
Attachments
sent2.py
(1.31 KiB) Downloaded 16 times
Box1.FCStd
(18.39 KiB) Downloaded 15 times
Last edited by manos on Wed Sep 28, 2022 12:38 pm, edited 1 time in total.
edwilliams16
Veteran
Posts: 3178
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: What does it mean "Pos=(0,0,0)" ?

Post by edwilliams16 »

The origin of Body is located at the origin of the sketch (which is outside your padded area). Its global placement is the zero vector, which says the origin of the body has not been moved. You could move it by changing its placement.
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: What does it mean "Pos=(0,0,0)" ?

Post by manos »

edwilliams16 wrote: Tue Sep 27, 2022 7:35 pm The origin of Body is located at the origin of the sketch (which is outside your padded area). Its global placement is the zero vector, which says the origin of the body has not been moved. You could move it by changing its placement.
So in other words the global placement Position: 1) When referred to additive primitive, is the "distance" of a primitive's point from the real O(0,0,0) - i.e useful.
2) When referred to pads, is the "distance" of a pad's point from an almost imaginary point (the sketche's (0,0,0) ) i.e. rather useless.

Is there any way to find that "Sketch Origin" and its Global Position ? Maybe using a Datum Point ?

edwilliams16 the news you brought are rather disappointing but thank you for the answer.
edwilliams16
Veteran
Posts: 3178
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: What does it mean "Pos=(0,0,0)" ?

Post by edwilliams16 »

Body has its own internal coordinate system (displayed under it in the object tree). When you obtain its global Placement, you find its location and orientation relative to the global coordinate system. In your simple case, they are coincident. Inside your body, you placed a Pad of a sketch. The sketch has its own coordinate system. In your case, it is co-located with that of the Body since it is attached to the default XY-Plane with no offset.
The local coordinate system of any sketch is that it has an origin, x and y axes and z comes out of the screen.
if you want to know the global location of some vertex on your pad, from first principles, you would need two pieces of information - where is the vertex located in the body's coordinate system and how do body coordinates relate to global coordinates. The first piece of information is a vector, the second a placement.

Code: Select all

doc = ActiveDocument
obj = doc.getObject("Body")
shp = obj.Shape

shp.Vertexes[14].Point
#Vector (-20.0, 10.0, 0.0)
gives the location of Vertex15 in body's coordinate system.

Code: Select all

place = obj.getGlobalPlacement()
place * shp.Vertexes[14].Point
#Vector (-20.0, 10.0, 0.0)
gives the global location of Vertex15. Change the Bodies placement and you will see this change with it.

It get more complicated when you use links, as you need to differentiate the location of the linked object from that of the original.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: What does it mean "Pos=(0,0,0)" ?

Post by openBrain »

manos wrote: Tue Sep 27, 2022 9:37 pm Is there any way to find that "Sketch Origin" and its Global Position ? Maybe using a Datum Point ?
I think you have problem with meaning of "origin".
Anyway, how about using

Code: Select all

App.ActivementDocument.Pad.Shape.BoundingBox
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

[SOLVED] Re: What does it mean "Pos=(0,0,0)" ?

Post by manos »

openBrain wrote: Wed Sep 28, 2022 7:02 am
manos wrote: Tue Sep 27, 2022 9:37 pm Is there any way to find that "Sketch Origin" and its Global Position ? Maybe using a Datum Point ?
I think you have problem with meaning of "origin".
Of course I have problem with Origin: It is supposed to be cornerstone of Coordinates and it is almost unusable.(Non selectable with mouse etc)
Anyway, how about using

Code: Select all

App.ActiveDocument.Pad.Shape.BoundingBox
I will remain loyal to points coordinates, they work fine for me so far.
OpenBrain thank for the help.
Post Reply