Animate an angle between planes

Hi I’ve been struggling for two days to make a animation work. I have a simple assembly I’m practicing on. It consists of a 90 degree angle iron bolted onto a base. I set the axis constraints and the coplanar constraint then I set an angle constraint between the angle iron and the board edge (thin edge if you will). I want to animate that angle constraint changing. Is there a way to step through the constraint angle with an animation?

What I’m not trying to do is move the part with a placer in the animation. I want to step through the angle constraint. I followed a number of tutorials to animate the part object with various toolboxes but none of them simply step through a plane angle constraint.

Then I have a third part that bolts to the angle bracket. When the angle L bracket gets to 90 degrees the third part can rotate through a slot in the board. i set also an angle constraint between the third part and the L bracket.

Hi dimension, welcome. From the rather general description you give and not knowing which tutorials you watched only general hints can be given:

  • Yes it is possible to step through angle constraints.
  • There is an animation workbench which might help. You can install it with teh Addon manager.

Yessir I also used the animation toolbox, the exploded assembly and attempted with the robot toolbox as well.

Some general idea how to go about animating an angle constraint would really help. Like in animation toolbox which tool do you use and point to the constraint?

I watched so many tutorials, probably 7-8 and none animate a constraint angle. There is not much documentation for the animation workbench.

In other words "yes it’s possible " but my question is how do you do it?

For further clarification the angle constraint I want to step through is an assembly constraint, It is not a constraint from the sketcher.


I just want to step through the angle constraint of two planes from an assembly with the animation workbench but I cannot find any instruction to do this.


The only thing that comes close is to manually adjust the angle under the constraint object. All I want to do is step through that angle with the animator.

When I manually adjust the angle constraint for the two planes this is the object that changes in the python console:
FreeCAD.getDocument(“myDocument”).getObject(“angleConstraint01”).angle = xxxxxx

where xxxxx is the angle I want to animate.

I can accomplish this by right clicking on the constraint and choosing assembly2 → animate. All i want to do is use the animation workbench to do it.

So this is in fact a completely different game, and I haven’t seen any tutorials about this. I move this topic to Assembly forum.

Thats correct, I can’t find any tutorials about this.

Just to re-iterate what I’m trying to do:

I want to perform the animation that I see when I right click the plane angle constraint → Assembly2 → Animate.

I want to do that animation with the animation workbench, or at least control the animation so that I can add a second, similar, animation to the ‘movie’.

Thanks

Hi dimension4. This macro is for assembly2. There is no one keeping up assemby2. I’m using A2plus but there is also Assembly 3 that is being worked on.
You did not mention if you had tried writing code or if you’re familiar with writing code. I have written this macro to rotate a part in assembly2. At the beginning you will need to enter the name of the constraint. Then enter the amount you want to increment and the number of times you want to loop. Then run it. I’m attaching the macro, assembly and part. The assembly is just two cubes hinged at an edge.
Hopefully this helps.
Dan
s2x4x925.FCStd (3.41 KB)
assm2rotate.FCStd (6.48 KB)
Rotate Assm2.FCMacro (865 Bytes)

Thank you Dan,
I will try it this evening.
Yes I used both A2 and A2+. I actually prefer A2+ it has a better time (doesn’t fail as often) building the assembly.
So I would actually prefer to use A2+

But maybe if I can reverse engineer what you’ve sent me I can apply it to A2+ also.

I’ve not tried A3. I’m not programmer savy enough to do all the git and brew. I’m very glad the latest freecad has a utility to install the workbenches.

An easier visual of what I’m trying to animate is to picture a windmill, the blades rotate and also the head rotates. I realized my initial description was long, and probably hard to picture.

Here is a version of the other macro. This one has a dialog box.
Directions are here. https://youtu.be/0IMpBlG6xtQ
assm2rotate.FCStd (6.5 KB)
RotateAssm2.FCMacro (4.89 KB)

Tip: You can put the youtube clip in the following bbcode to display it

[video][/video]

HI Dan,

Thank you very much! :smiley: :smiley: :smiley:

You really helped me a lot! I had no idea! I did not realize that the macro function could do such things. I had not used the macros before. I think now it will not be much leap for me to add a second degree of freedom. I really appreciate it, and the dialog box is awesome!

I’m glad you found it useful. Technically, I’ve been told, these are not macros because macros, as in MS are recorded, then used. This was written from scratch. I’ve been using FreeCAD and python since September and I agree with you, they can do pretty awesome things.
P.S. This seems to work with any constraint that has an “angle” variable so it works in both assemly2 and A2plus.
Dan

Thanks, I got it to work for assembly 2

For Assembly 2 Plus there is a different problem:
I can assign the ‘angle between planes’ but I can only change the angle once. Then I try to change the angle again and it does nothing. I mean I am manually entering the angle in the assembly 2 plus box, no macros or anything.

edit: if I type a number for the angle in the box it does not register, but if I use the up/down arrows to change the angle it will work move the angle when I click on the drawing. this is in a2+

To prevent a person from picking a part instead of a constraint I was looking for the letters “Con” in the name. Kbwbe uses the name angleplanes so I have changed it to look for “ang” instead. The odd behavior was because when I stopped the program when it couldn’t fine “Con” I had put the shutoff for the observer after the program quit. The only way i know of to turn the observer off is to close FreeCAD and start it again. I have moved the shut off before the check. I also had to add the A2plus solver to make it run. I also added an error window to alert the user that the wrong mate was chosen.

The program runs but it errors before very long. I’m not sure why. I’m attaching it anyway so you can look at the changes if you would like.
Dan
RotateAssm2_ver2.FCMacro (5.71 KB)

Thanks Dan for doing that!

Is the plane angle constraint issue something that is known for A2+ or should I report it?

Hi,
i cannot reproduce this. On my side, i can change the angle as often as i want and it works.
Please can you upload a simple file where it is not working ?

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13541 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.14
Qt version: 5.10.1
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)

It is reproducible for me. I change the angle a few times and it freezes. I just built this example which looks similar to what I’m working on, although simpler. I added the constraints in an assembly and uploaded that with the part files too. Then I changed the angle constraint a number of times (didn’t count, about 6) and it froze so that the screen doesn’t update. It doesn’t show any error, just doesn’t do anything when you type in a new angle.

edit: it freezes when you pass through 0 degrees or 180 degrees. Not sure why that would be. Assembly 2 doesn’t seem to have that problem.
part1.FCStd (15 KB)
base.FCStd (13.4 KB)
frozen.FCStd (8.42 KB)
assembly.FCStd (8.54 KB)

This is a known issue. There is a warning within the tool tips. planesAngleConstraint works between 0 and 180 degrees. But with 0,180,360..etc. it does not work. Even passing through this values is not possible ATM.

Edit: Simply move the part with the manipulator a little bit into right direction, then the solver will place it correct again.