Page 1 of 2

Maxwell Animation in Solidworks

Posted: Thu Jan 11, 2007 7:13 pm
by w i l l
Is it possible to do Maxwell animations within Solidworks using the animator?

Posted: Thu Jan 11, 2007 8:37 pm
by b-kandor
no - but you could write a macro to step through you animator sequence and save out an mxs for each frame. Then there is that utility in the goodies section for automating the rendering of sequenced mxs files.

Posted: Fri May 11, 2007 2:22 am
by w i l l
Have you by chance written such a macro? Or know of a useful link?

Solidworks macro

Posted: Tue May 22, 2007 7:57 am
by Jukka Laattala

Posted: Thu May 24, 2007 9:19 pm
by w i l l
Nice one! I'll look into that.

I didn't realise that with the new plugin you could convert a Solidworks texture to a Maxwell texture too.

Jaun or anyone - Is this a new thing with the 1.5 update? Does this mean that the plugin could potentially/nearly be as good as Studio?

Posted: Thu May 24, 2007 11:05 pm
by superbad
It's actually always been that way- textures applied in SW get carried over to Maxwell. The problem is you can't really control the positioning and projection of the textures in Solidworks.

Posted: Thu May 24, 2007 11:12 pm
by w i l l
Yeah you can sort of control them though.

Posted: Fri May 25, 2007 12:50 am
by superbad
Exactly. Depends on what you're doing really- almost everything I render is made from wood, so it's no good for me. If you were just using non directional bump maps it might be alright.

Posted: Thu Aug 30, 2007 8:15 pm
by w i l l
Any news on if/when Maxwell can be used to render out frames from Solidworks animator?

This would be so good.

Posted: Thu Aug 30, 2007 10:11 pm
by b-kandor
Hi Will,

I thought someone wrote a macro to do this already - but my mind is going.... I'll try to remember.

I just did a google search: "solidworks animator macro frame" This was the first link:

http://xenic1.googlepages.com/apiExample2.html

Looks like it's just what you need, create a new macro, copy paste the vb code on that page into your macro - save it. Then run from the tools menu or bind to key or button.

Let me know how it goes? I'm too busy to experiment right now.

Posted: Thu Aug 30, 2007 11:06 pm
by w i l l
Yeah i thought that was a macro to simulate changes in light - is there a part of that macro that can be used to export mxi/mxs files for any animation set up in animator?

Maybe its just the last 2 parts...... plus part of the first?:



Sub GenerateMXSFrame(
nltAddin As swMaxwell2006.CswMaxwell2006,
dirName As String,
index As Long,
outputFile
)
Dim MyName As String
Dim myMXS As String
Dim myIMG As String
Dim res As Long
MyName = CStr(index)
myMXS = dirName + MyName + “.mxs”
myIMG = dirName + MyName + “.jpg”
res = nltAddin.ExportToMxs(myMXS, myIMG, False)
Call AddCommandToBatchRenderFile(dirName + MyName, outputFile)
End Sub




Sub AddCommandToBatchRenderFile(name, outputFile)
mxsfile = name + “.mxs”
imgfile = name + “.jpg”

CommandLine = “mxcl -mxs:” + mxsfile
CommandLine = CommandLine & “ -output:” & imgfile
CommandLine = CommandLine & “ -sampling:11”
CommandLine = CommandLine & “ -threads:4”
CommandLine = CommandLine & “ -nowait”

outputFile.WriteLine (CommandLine)

End Sub



?

Posted: Thu Aug 30, 2007 11:35 pm
by b-kandor
Yep your right - I didn't look at it closely. The code you copied will just save an mxs file. No part of that macro controls the animator addin and after consulting the api documentation there is no method of advancing frame by frame. You can play for a set duration in seconds like .1 sec so if you had 10 fps set as you animation speed this could work....

Posted: Fri Aug 31, 2007 12:51 am
by w i l l
Hmmm dont know - i haven't had any experience with coding but i'm getting into Solidworks animating (or what there is of it) and would love to try with the plugin.

At the moment i'm setting up the animation then moving the time bar/cursor one frame forward at a time and clicking render to get a series of images. Bit of a nightmare.

Posted: Fri Aug 31, 2007 1:05 am
by b-kandor
How many frames per second do you get dragging the bar - it looks like a lot?

Posted: Fri Aug 31, 2007 1:12 am
by w i l l
Any (or a lot) - you just keep zooming in.