[Assembly 4] Part orientation flips based on variable (rotation angle)

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Caraes_Naur
Posts: 2
Joined: Wed Jul 21, 2021 12:02 am

[Assembly 4] Part orientation flips based on variable (rotation angle)

Post by Caraes_Naur »

I'm modelling an engine following this tutorial by Mads Leth Danielsen for building the assembly. The engine itself is based on the Napier Lion (that page may be useful for reference).

  • OS: Ubuntu 18.04/KDE
  • FreeCAD Version: 0.19.2+dfsg1~202107140647~ubuntu18.04.1
My Assembly4 model has one variable, Crank_Angle. When this nears 0 or 180, the main rods (dark green) flip 180 degrees around their local LCS Z axis. The two main rods placed in the model so far flip approximately 0.00005 degrees apart.

Each part has a red orientation mark. On the main rods, this is an "L". These are visible in the images, along with the local (within the part) LCS of the main rods.

Not shown are the main rod caps, which are attached to the same LCS objects on the Model scaffold sketches (one for each crank journal).

These images show the second main rod flipping. The front rod (shown with pistons attached) flips at 180.00002 and 359.99998. The only thing changing is the Crank_angle value. This occurs when changing the variable manually and during assembly animation.

Crank_Angle: 0.0:
Crank_Angle: 0.0
Crank_Angle: 0.0
lcs_issue_00000000.png (341.37 KiB) Viewed 1619 times
Crank_Angle: 0.00003:
Crank_Angle: 0.00003
Crank_Angle: 0.00003
lcs_issue_00000003.png (341.44 KiB) Viewed 1619 times
Crank_Angle: 179.99997
Crank_Angle 179.99997
Crank_Angle 179.99997
lcs_issue_17999997.png (306.12 KiB) Viewed 1619 times
Crank_Angle: 180.0
Crank_Angle: 180.0
Crank_Angle: 180.0
lcs_issue_18000000.png (305.43 KiB) Viewed 1619 times
Notice how the red "L" on the second dark green main rod appears and disappears throughout the rotation as its LCS orientation changes.

Finally, the combo view showing the main rod local LCS properties:
combo view
combo view
lcs_issue_local_lcs.png (75.15 KiB) Viewed 1619 times
I suspect this is related to the LCS being mapped with InertialCS, but I don't see how to map it otherwise as there is little physical geometry aligned with the origin point. The edges I used are the result of a fillet (but not created by it), which is not ideal.

All the corresponding Model LCS are mapped to a vertex and line in the scaffold sketch using OXY. This is the only mapping for them that is correct and remains stable.

In previous attempts to fix this, the parts turned 90 degrees on their local Z, or only flipped near Crank_Angle 180 and immediately flipped back. Unfortunately, I have no idea how I stumbled into those partial solutions and didn't save the file to preserve them.

How do I map the part local LCS in a way that remains stable?
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: [Assembly 4] Part orientation flips based on variable (rotation angle)

Post by Zolko »

Caraes_Naur wrote: Thu Jul 22, 2021 7:40 am How do I map the part local LCS in a way that remains stable?
Nice model ! I did something similar, but much simpler :

Image


the principle is a rotating LCS in the main assembly, to which you attach the crankshaft. The crankshaft has datum points at the relevant position where the pistons attach. These datum points are imported into the main assembly, and then you create a master-sketch for each piston, importing its attachment point, and drawing the piston movement. You then attach LCS (by OXY) to these master sketches, and attach your parts to these LCS.

Try to look here:

https://github.com/Zolko-123/FreeCAD_Ex ... 4_Example2
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Caraes_Naur
Posts: 2
Joined: Wed Jul 21, 2021 12:02 am

Re: [Assembly 4] Part orientation flips based on variable (rotation angle)

Post by Caraes_Naur »

Zolko wrote: Thu Jul 22, 2021 2:37 pm Nice model !
Thanks. I'm pretty proud of the crankshaft. The spreadsheet in the file has almost 40 dimensions in it.

I've seen that example, but am wary of opening it because of the age of the files. I know FreeCAD has been in heavy flux since 0.19.

There's nothing simple about this engine layout. The master sketch in the Main Rod that positions the two Link Rod holes is full of crazy construction lines. A different version of that construction geometry exists in the Assembly sketches to position the Link Rod LCSes.

The pistons seem fine. It's just the Main Rod part LCSs that lose their orientation in the assembly.

Could I create a dummy sketch in the Main Rod to support the LCS? If I'm understanding your reply correctly, that seems to be part how that example is set up.

I have attempted to model this engine before in Blender, however that version had 12 individual (normal) rods each with a separate journal. That crankshaft was bonkers. It also had 90 degree V angles, which I've since learned wouldn't work.

I'm considering/dreading going back to individual rods here because right now the side bank stoke lengths don't match the central bank.

Bottom end geometry on a W engine (this is the original W, not what Volkswagen/Bugatti calls a W now) is tricky. It can be done with unequal rods lengths, however I also want to keep the block deck heights an equal distance from the crank axis.
Post Reply