what is the difference between placement and attachment?

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!
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: what is the difference between placement and attachment?

Post by manos »

drmacro wrote: Sat Jul 02, 2022 12:51 pm
It is more a lesson than a mere answer.
I will incorporate it in my notes about coordinates. Thank you for your time drmacro.
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: what is the difference between placement and attachment?

Post by manos »

drmacro wrote: Sat Jul 02, 2022 12:51 pm
A sketch in a Body always references the Origin object of the Body. The LCS of the sketch is confusing to many. When a sketch is created the origin of the sketch is somewhere in the Body LCS (the Body LCS, is represented by the Origin object). When you open the sketch it has, let's call it a temporary LCS, where +Z is from the Root point out of the screen, +X is from the Root point to the right, and +Y is from the Root point up.
Root point is the intersection of X and Y axis of the sketch?
Those axis (plus the vertical Z) are always the axis of the sketch ? Even after any attachment or Placement ?
Please answer yes.
Last edited by manos on Sat Jul 02, 2022 5:59 pm, edited 1 time in total.
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Attachment offset relation with Attachment Data

Post by manos »

Attachment offset is a part of Attachment Data of an object, if the object is attached .

True or False ?
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: what is the difference between placement and attachment?

Post by drmacro »

manos wrote: Sat Jul 02, 2022 5:46 pm
drmacro wrote: Sat Jul 02, 2022 12:51 pm
A sketch in a Body always references the Origin object of the Body. The LCS of the sketch is confusing to many. When a sketch is created the origin of the sketch is somewhere in the Body LCS (the Body LCS, is represented by the Origin object). When you open the sketch it has, let's call it a temporary LCS, where +Z is from the Root point out of the screen, +X is from the Root point to the right, and +Y is from the Root point up.
Root point is the intersection of X and Y axis of the sketch?
Those axis (plus the vertical Z) are always the axis of the sketch ? Even after any attachment or Placement ?
Please answer yes.
Yes
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Attachment offset relation with Attachment Data

Post by drmacro »

manos wrote: Sat Jul 02, 2022 5:57 pm Attachment offset is a part of Attachment Data of an object, if the object is attached .

True or False ?
True, I guess. The Attachment offset shown in properties represents the some of the Properties of the Attachment (OOP) object.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: what is the difference between placement and attachment?

Post by manos »

drmacro wrote: Sat Jul 02, 2022 6:19 pm
manos wrote: Sat Jul 02, 2022 5:46 pm
drmacro wrote: Sat Jul 02, 2022 12:51 pm
A sketch in a Body always references the Origin object of the Body. The LCS of the sketch is confusing to many. When a sketch is created the origin of the sketch is somewhere in the Body LCS (the Body LCS, is represented by the Origin object). When you open the sketch it has, let's call it a temporary LCS, where +Z is from the Root point out of the screen, +X is from the Root point to the right, and +Y is from the Root point up.
Root point is the intersection of X and Y axis of the sketch?
Those axis (plus the vertical Z) are always the axis of the sketch ? Even after any attachment or Placement ?
Please answer yes.
Yes
Cool . Is that stands also when we create the sketch in PartDesign WB ?

That's means that we can see the Origin of a Sketch while in editing mode but not after finishing editing. If it is true, it is better than nothing.

Anyway is there a way to measure the distance between the Origin of Body and the Origin of the Sketch ? Maybe with Attachment of the Sketch?
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: Attachment offset relation with Attachment Data

Post by manos »

drmacro wrote: Sat Jul 02, 2022 6:21 pm
manos wrote: Sat Jul 02, 2022 5:57 pm Attachment offset is a part of Attachment Data of an object, if the object is attached .

True or False ?
True, I guess. The Attachment offset shown in properties represents the some of the Properties of the Attachment (OOP) object.
You mean:The Attachment offset shown in properties represents the sum of the Properties of the Attachment (OOP) object. ?
OR
You mean:The Attachment offset shown in properties represents some of the Properties of the Attachment (OOP) object. ?
OR something else ?
Thanks @drmacro
Last edited by manos on Fri Jul 08, 2022 9:11 am, edited 2 times in total.
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: what is the difference between placement and attachment?

Post by manos »

adrianinsaval wrote: Thu Mar 10, 2022 3:38 pm ok this might get long...
Frankly it is not long at all
...(if you ever studied physics
In fact I have studied physics.

Every object that has a shape has a placement property (including Part and Body containers) that defines it's position in the coordinate system were this object is located, so the placement of objects in the root level of the tree is relative to the GCS, the placement of object inside a Part container is relative to Part's OWN CS (and these can be nested, you can have an object inside a part inside a part, the placement of each will be RELATIVE to it's parent)..
The two magenta phrases seems to me contradictory. Any help ?
Now attachments and attachment offset. This can easily confuse you as in some case you may see that the attachment offset and the placement are the same, this happens when an object is attached to something with placed at the origin and with no rotation.
In general you can attach an object to another and this binds the object's placement to whatever it is attached to, for example you can attach a sketch to the top face of a cube, then you can see that it's placement z value is the same as the cube height (for example 10mm), your attachment offset is still 0.
The attachment offset let's you move the object relative to the attachment point, try editing the attachment offset of that sketch to z=10mm you will then see that the placement of the sketch now has z=20mm. So attaching the sketch to the face move it 10mm up, then with the offset you moved it 10mm more.
Please accept questions about this paragraph at the next days .
Thank you very much adrianinsaval
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: what is the difference between placement and attachment?

Post by edwilliams16 »

Let me put my spin on this. It's hard to explain this stuff without a concrete example. So here goes.
Screen Shot 2022-07-02 at 12.56.17 PM.png
Screen Shot 2022-07-02 at 12.56.17 PM.png (28.05 KiB) Viewed 679 times
We have a Part Container inside of which there is a Body.
The body contains a box.
Attached to the box are a Datum Point, an LCS and a sketch.

The Part has an Identity Placement
Screen Shot 2022-07-02 at 1.04.21 PM.png
Screen Shot 2022-07-02 at 1.04.21 PM.png (12.04 KiB) Viewed 679 times

Code: Select all

doc + App.ActiveDocument
obj = doc.getObject("Part")
obj.Placement # Placement [Pos=(0,0,0), Yaw-Pitch-Roll=(0,0,0)]
Its coordinate system is therefore the same as the Global Coordinate System (GCS)
Body has no Attachment, and is displaced (0, 0, 10) from Part, its container.
Screen Shot 2022-07-02 at 1.09.49 PM.png
Screen Shot 2022-07-02 at 1.09.49 PM.png (11.38 KiB) Viewed 679 times
Box is attached to YZ_Plane of Body. It's Attachment Offset is (0, 0, 20). (I'm not rotating the attachments, because it is hard to visualize).
Screen Shot 2022-07-02 at 1.13.37 PM.png
Screen Shot 2022-07-02 at 1.13.37 PM.png (49.91 KiB) Viewed 679 times
When an object has an Attachment Offset, its Placement becomes read-only. It is the calculated Placement of the object relative to its container.
In this case the container is Body, the calculated Placement is the rotation that brings the XY-Plane into the YZ_Plane combined with the offset displacement. The attachment offset (0, 0, 20) is in the direction perpendicular to the attached-to YZ_Plane - which is the Body X-direction. Thus, we see that the displacement portion of the Box's Placement is (20, 0, 0).

Code: Select all

obj = doc.getObject("Box")
obj.AttachmentOffset  #Placement [Pos=(0,0,20), Yaw-Pitch-Roll=(0,0,0)]
obj.Placement #Placement [Pos=(20,-4.44089e-15,4.44089e-15), Yaw-Pitch-Roll=(90,1.27222e-14,90)]
The Datum Point and LCS are attached to the Origin and Local Coordinate system of Box for visualization purposes. See https://wiki.freecadweb.org/O-X-Y_type_attachment_modes as to how this was done.

Finally, Sketch is attached to the bottom face of Box with its x and y axes aligned with those of the Box. It is then given an Attachment offset of (0, 0, 20). Again the z-direction is perpendicular to the sketch, which gives an additional displacement of (20, 0 ,0) relative to Body for a total of (40, 0, 0).
The read-only Placement of Sketch includes the effect of the Attachments and all the Attachment Offsets within the Body. The Placement is the combined effect of all these and is the computed Placement of the Sketch relative to its container Body.

In general the Global Placement of an object is the combined effect of the Placements of its nested containers and its Placement within its immediate container.
How do we find which object (if any) is the container of a given one, other than looking at the tree?

Code: Select all

obj = doc.getObject("Sketch")
obj.getParentGeoFeatureGroup().Name #    'Body'
If you select the origin of the sketch and look its global position in the Status Bar, you'll see (40, 0, 10). See if you understand why from the compounding of the nested Placements.

It all gets a little more complicated when we discuss linked copies of objects.
See https://wiki.freecadweb.org/Sandbox:Edw ... #Placement for more scripting info.
Attachments
AttachExample.FCStd
(12.4 KiB) Downloaded 12 times
manos
Posts: 432
Joined: Thu Nov 12, 2020 10:48 am
Location: Greece

Re: what is the difference between placement and attachment?

Post by manos »

@edwilliams16 Very interesting post.
Combined with your Sandbox and other post of yours offer a total of useful knowledges.
Sory for the delay Thanks a lot
Post Reply