Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to animate a parameter in Catia

Status
Not open for further replies.

skyform

Computer
Apr 4, 2013
2
US
I am trying to create an animation of an object that shows the variation of a single parameter -- in this case a radius length value. I would like to create a 10-second animation, using a fixed camera position in Photo Studio, that animates this parameter. I have attached a series of screen shots showing the range of the middle radius parameter -- from .5in to 3.0in -- for reference.


Any advice on how to animate this parameter would be greatly appreciated. Advance thanks.

 
Replies continue below

Recommended for you

Code:
Language="VBSCRIPT"

Sub CATMain()

Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set parameters1 = part1.Parameters
Set selection1 = CATIA.ActiveDocument.selection
Set objViewer3D = CATIA.ActiveWindow.ActiveViewer
Set objCamera3D = CATIA.ActiveDocument.Cameras.Item(1) 
objViewer3D.FullScreen = True 
exten = ".png"
fileloc = "D:\"
imagename="animation"
objViewer3D.Viewpoint3D = objCamera3D.Viewpoint3D

if selection1.count=1 then
Set length1 = parameters1.Item(selection1.item(1).value.name)
storedValue=length1.Value

initial= InputBox("Input initial value of parameter")
final= InputBox("Input final value of parameter")
noOfSteps= InputBox("Input number of steps")
step=(final-initial)/(noOfSteps-1)

for i=1 to noOfSteps
length1.Value=initial+(i-1)*step
part1.Update 
strname = fileloc & imagename & Cstr(i) & exten
'msgbox strname
objviewer3D.Capturetofile 4,strname
next

objViewer3D.FullScreen = False
length1.Value=storedValue
part1.Update 
else 
msgbox "Select only 1 parameter!"
End If

End Sub

Anyway, I wrote small macro to animate parameter and create set of images with /png extension. You can merge those files manually with almost minor of graphic programs, e.g. gimp.
Location: D:\ (You can change it manually)

Hide all unnecessary elements (sketches, etc), select parameter to animate and run macro



LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Thanks for the link and the macro LukaszSz!

I wasn't able to get the spring example to work yesterday but it seems like it is not far off. One of my goals is to render from the animation tab within the Photo Studio shooting definition so that I can use the indirect illumination settings.

I will give your macro a try now. Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor