2 Replies Latest reply on Feb 28, 2018 6:18 AM by Rob Edwards

    Hello friends, is it possible to animate equation with solidworks 2016?

    Younsi Maher

      I made a revolted surface with y=sin(x+k)/x. I tried to vary the phase "k" to create an animation but it doesn't work .any ideas ?

        • Re: Hello friends, is it possible to animate equation with solidworks 2016?
          Mahir Abrahim

          You could try animating display states. Create multiple versions of the revolved body, each one using a different curve with a different k. You can then animate the visibility of each body, sequentially changing the visibility/transparency of each body one after the other, kind of like a time lapse video.

          • Re: Hello friends, is it possible to animate equation with solidworks 2016?
            Rob Edwards

            Hi Younsi

            I made the global variable "k" = to a sketch dimension (just to make things easier).  Unfortunately (as usual) I couldn't get the Motion Study to work.

             

            So I recorded a macro of editing the dimension, CTRL-Q rebuild and save as png

            This gave me

            Option Explicit
            
            ' ******************************************************************************
            ' C:\Users\369\AppData\Local\Temp\swx6468\Macro1.swb - macro recorded on 02/28/18 by 369
            ' ******************************************************************************
            Dim swApp As Object
            
            Dim Part As Object
            Dim boolstatus As Boolean
            Dim longstatus As Long, longwarnings As Long
            
            Sub main()
            
            Set swApp = _
            Application.SldWorks
            
            Set Part = swApp.ActiveDoc
            boolstatus = Part.Extension.SelectByID2("D1@Sketch1@eqani.SLDPRT", "DIMENSION", 3.98313009457744E-02, 5.88555797084891E-02, 0.111978588735138, True, 0, Nothing, 0)
            Dim myDimension As Object
            Set myDimension = Part.Parameter("D1@Sketch1")
            myDimension.SystemValue = 0.003
            boolstatus = Part.ForceRebuild3(True)
            Part.ClearSelection2 True
            longstatus = Part.SaveAs3("C:\Users\369\Desktop\images\eqani.PNG", 0, 0)
            End Sub
            

             

            I then just edited the macro to create a loop

             

            Option Explicit
            
            ' ******************************************************************************
            ' C:\Users\369\AppData\Local\Temp\swx6468\Macro1.swb - macro recorded on 02/28/18 by 369
            ' ******************************************************************************
            Dim swApp As Object
            
            Dim Part As Object
            Dim boolstatus As Boolean
            Dim longstatus As Long, longwarnings As Long
            
            Sub main()
            
            Set swApp = _
            Application.SldWorks
            
            Set Part = swApp.ActiveDoc
            Dim myDimension As Object
            Set myDimension = Part.Parameter("D1@Sketch1")
            Dim k As Integer
            Dim framecount As Integer
            framecount = 0
            For k = 1 To 300
                myDimension.SystemValue = k / 10000
                boolstatus = Part.ForceRebuild3(True)
                longstatus = Part.SaveAs3("C:\Users\369\Desktop\images\eqani" & framecount & ".PNG", 0, 0)
                framecount = framecount + 1
            Next k
            End Sub
            

             

            Then just add the images to your favourite Move Maker and you're done