Understanding 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!
Simonski
Posts: 38
Joined: Wed Nov 24, 2021 11:31 am

Understanding Attachment

Post by Simonski »

Using Part WB, I added a cube and a cone to a new document. I then set the attachment of the cone to right side of the cube using the ‘Inertial CS’ map mode. This positioned the cone pointing outwards from the cube with its small end in the centre of the face.

If I then rotate the cube around the Z axis, between 135 and 315 degrees the cone flips from pointing outwards to inside the cube instead.

Once attached, I would intuitively expect the cone to always face outwards whatever the orientation of the cube, so what is the rationale for this behaviour? It also seems to be at odds with the statement in the Basic Attachment Tutorial:
Attachment is a utility to attach an object to another one. This links the two objects' placement properties, the attached object will then follow the original (if its placement is changed.)
Attachments
ConeAttachedToCube.png
ConeAttachedToCube.png (49.59 KiB) Viewed 3150 times
User avatar
thomas-neemann
Veteran
Posts: 11801
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: Understanding Attachment

Post by thomas-neemann »

Simonski wrote: Fri Nov 26, 2021 12:19 pm
I also work non-parametrically for reasons like this. i would join the parts together with draft move and rotate and if they should stay together, connect them with part compound.


edit

I find it intuitive and fast. In addition, this creates stable models without a topo- problem


edit 2

i work like that


https://www.youtube.com/watch?v=-lMNDjrsHPs


phpBB [video]
Last edited by thomas-neemann on Fri Nov 26, 2021 2:45 pm, edited 1 time in total.
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Understanding Attachment

Post by chrisb »

You attach the local origin of the cone plus its orientation. If you rotate, the origin remains in place. Your images are a bit misleading, because the global origin is in different positions.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Understanding Attachment

Post by Roy_043 »

chrisb wrote: Fri Nov 26, 2021 1:49 pm Your images are a bit misleading, because the global origin is in different positions.
Not really. That is what you get when you change the rotation of a Part_Box from 0 to 180 degrees.

If I apply "Inertial CS" there is an error. The error also occurs when I follow the tutorial.
AttachEngine3D::calculateAttachedPlacement:InertialCS: inertia tensor has axis of symmetry. Second and third axes of inertia are undefined.

Try using "XY on plane" instead.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Understanding Attachment

Post by chrisb »

Oh sorry, I didn't realize that the Cube was rotated :oops: .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Understanding Attachment

Post by TheMarkster »

The warning when attaching via inertial cs mode now makes more sense to me. It is not a stable attachment when that warning is issued. For a more robust attachment use the FlatFace mode aka xy on plane. These names should be the same, but for some reason are not. InertialCS conveniently centers on the face, but this is easy enough to to accomplish by editing the attachment offset property using expressions.

x =Box.Width/2
y = Box.Height/2

Note: Box is internal name of the Cube object. Alternatively, <<Cube>>.Width/2 could be used.

There is reference to topological naming in this thread. It is worth your while to read more about this issue if you intend to use attachments to faces. In this particular case it is perfectly safe to attach to a cube's face because the cube, being a primitive object, will never change the names of its faces no matter what you do to it.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Understanding Attachment

Post by Roy_043 »

I would be interested in the geometry you would need for a stable use of "Inertial CS" in this case.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Understanding Attachment

Post by adrianinsaval »

something that doesn't have an axis of symmetry?
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Understanding Attachment

Post by Roy_043 »

adrianinsaval wrote: Fri Nov 26, 2021 6:31 pm something that doesn't have an axis of symmetry?
That does suppress the warning. But still the attachment shows a similar instability.
See the attached file. If the rotation angle of the Cut is between 45 and 225 the cone flips to the other side of the face.
Attachments
InertialCS.FCStd
(9.33 KiB) Downloaded 37 times
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Understanding Attachment

Post by TheMarkster »

Roy_043 wrote: Fri Nov 26, 2021 6:48 pm
adrianinsaval wrote: Fri Nov 26, 2021 6:31 pm something that doesn't have an axis of symmetry?
That does suppress the warning. But still the attachment shows a similar instability.
See the attached file. If the rotation angle of the Cut is between 45 and 225 the cone flips to the other side of the face.
Very interesting.

As a side note it is better to avoid attaching to the face of the cut object because of potential TNP issues. You should instead modify the workflow to attach to the cube primitive face where possible.

Here is a convoluted workaround that (I think) works in this particular case:

The Cone's MapReversed property is set to this expression:

Code: Select all

Cut.Placement.Rotation.Angle >= 45 ? (Cut.Placement.Rotation.Angle <= 225 ? True : False) : False
I also set Cube's Length from 10 mm to 10.001 mm, but I'm not sure if that matters. InertialCS seems to work better when the face is not a square.
Attachments
InertialCS_workaround.FCStd
(8.35 KiB) Downloaded 22 times
Post Reply