Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revolute Joint Motion Faster/Smoother via Animate than driven by Script

3 REPLIES 3
Reply
Message 1 of 4
RogerInHawaii
683 Views, 3 Replies

Revolute Joint Motion Faster/Smoother via Animate than driven by Script

I've got some Revolute joints. If I use the Animate option on the model the motion of the joint is really nice and smooth and fast...


But if I use a C++ Script to do the animation it's quite jerky and not nearly as fast...


The script that's driving the joint is basically this...

 

double Pi = 3.1415926535897;
double angle360DegreesInPiTerms = 2*Pi;
double angle180DegreesInPiTerms = Pi;
double angle90DegreesInPiTerms = Pi / 2;
double angle45DegreesInPiTerms = Pi / 4;
double angle1DegreeInPiTerms = 0.0174533;
double angle0DegreeInPiTerms = 0.0;

// Move joint UP 90 degrees (from initial 0 degrees)
for (double angle = 0.0 ; angle <= angle90DegreesInPiTerms; angle += angle1DegreeInPiTerms * 3)
{
	itsRevoluteJointMotion->rotationValue(angle);
	adsk::doEvents();
}
// Move joint down to -90 degrees
for (double angle = angle90DegreesInPiTerms; angle >= -angle90DegreesInPiTerms; angle -= angle1DegreeInPiTerms * 3)
{
	itsRevoluteJointMotion->rotationValue(angle);
	adsk::doEvents();
}
// Move joint back to 0 degrees
for (double angle = -angle90DegreesInPiTerms; angle <= 0.0 ; angle += angle1DegreeInPiTerms * 3)
{
	itsRevoluteJointMotion->rotationValue(angle);
	adsk::doEvents();
}

So why is the model-driven Animate so much faster and smoother than one driven by a C++ script? I tried several different "increments" in the for-loops and nothing makes it any better.

 

3 REPLIES 3
Message 2 of 4

Could someone please address this issue?

 

I really need my script-driven animations to be just as fast as the built-in Joint "Animate" option.

 

Message 3 of 4

Hi,

I am experiencing the exact same problem.

Did you find anything to explain and/or improve this issue ?

 

Has anybody else found anything ?

 

Regards !

 

Message 4 of 4

It's been a long time since I worked on that particular project and that particular issue.

I do recall, once in a while, when I was much later working on a different project but also trying to manipulate components by means of a script, that if I was doing a lot of work on the script during one design/programming session, that the animation would seem to get slower and slower. But if I stopped working, shut down Fusion 350, turned the computer completely off, and came back to it later and then ran the script, it would work faster. I concluded that Fusion 360 was (maybe?) somehow getting bogged down, perhaps consuming lots and of lots of memory, maybe not freeing memory properly between sequential runs of the script, and that's what was causing the unacceptable slow-down of the animations.

So, you could give that a try. Just shut it down completely and restart the computer and restart Fusion 360 and get back into the project cleanly, then run the script again.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report