TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
When replying to a specific statement be sure to quote the previous post.

Using Script Editor and Key Frame Editor Together
Read 3056 times
* March 27, 2013, 03:21:13 PM
I am trying to animate a cam and follower. My plan was to rotate the cam using the Script Editor and then position the follower on the cam using the Key Frame Editor. The problem is this: When I go to the Key Frame Editor to position the follower, the rotation of the cam that I set in the Script Editor is not shown, making it impossible to set the follower to the correct position.
 
For example, if I set the cam to rotate at 1 degree from frame 1 to frame 60 using the Script Editor, and then go to the Key Frame Editor and show frame 10, I would expect to see the cam rotated 10 degrees. Then I could set the position of the follower for a cam position of 10 degrees, and so on through the animation. The result would be an animation of the follower riding on the cam as it rotates through the 60 frames of the animation.
 
Unfortunately, this isn’t what happens. When I go to frame 10 in the Key Frame Editor, the cam remains in the 0 degree position, making it impossible to set the follower to the correct position.
 
The only workaround I came up with is to set both the cam and follower using the Key Frame Editor, which is a lot more work.
 
My question is, am I doing something wrong or is that the way the program works?

Thanks, Kevin

Logged


* March 28, 2013, 01:52:27 AM
#1
RE - am I doing something wrong

No - your not wrong, as I understand it the script and custom script are just basically text files which are read when the scenario is played and thus can't be stepped into like the key-frame editor.

Andy

Logged


* March 28, 2013, 07:57:14 AM
#2
Thanks Andy.

I thought that was probably the case.  I use an animation program called Carrara 8, which allows you to set a rotation and then move objects relative to the rotated object.  I was hoping it was possible to do the same in Animation Lab but apparently not.
Thanks again.

Kevin

Logged


March 28, 2013, 09:48:23 AM
#3
Why not just write scripts for both parts?

I don't think it will help in your case but using parts, groups of parts, and groups of groups, etc. as actors is a good way to make parts move relative to each other. For example, you can explode an assembly by making the whole thing grow larger while each part grows smaller at the same rate. The parts appear to stay the same size and move away from each other.

Logged
mike
TC user since v3. MacMini 5.1. 2.3 GHz. 16 Gig RAM.
TC 19 Pro 64 bit. Windows 7.


* March 28, 2013, 11:35:51 AM
#4
Kevin

Just curious as to the shape of the cam,  Mike's idea is an excellent one but alas I'm a bit 'mathematically challenged' (not good with sine / cosine stuff) so couldn't help with that, there are some other ways for example if the cam was a simple ellipse it could be possible to use constraints (in TC pro versions),

What I sometimes do (always on a copy of the file in case something goes wrong) is set the rotate script to something small like from 0 to 4 at rotate 0.5 degrees, and just keep hitting the play button, the script will play from the last position not the start, allowing one to set up other objects, then use the inspection bar rotate field to re-set the rotation if need be (having coordinates properties set to entity / extents.

Andy

Logged


* March 28, 2013, 02:20:23 PM
#5
Mike: You're right, I could write scripts for both parts, but I always try to do it the easy way first!

Andy: That's brilliant! Hitting "Play" to position the cam, then repositioning the cam follower, and then repeating that cycle through one rotation of the cam is exactly the simple, elegant solution I should have figured out myself.  Thanks!

Kevin

Logged