2 Replies Latest reply on Jul 29, 2015 11:06 AM by Oscar Hellaeus

    Fatigue variable amplitude macro (array problem)

    Oscar Hellaeus

      Hi,

       

      Im trying to create a macro to create multiple fatigue studies with multiple forces and time series.

       

      I have been successful in creating the studies and the fatigue events but my problem is getting my amplitude and time series data imported correctly.

       

      I am using this example that i want to modify to create the different events:

       

      2015 SOLIDWORKS API Help - Create Fatigue Study Example (VBA)

       

      I want to import my data either from a .txt file or most preferably an excel file. I have no problem to import from excel its just how to get it into the right array format.

       

      This is where the event is created and i want the data from a file instead of written directly in the code.

       

          PointsX = Array(0, 1, 2, 3, 4, 5, 6.25714, 7, 8.3846, 9, 10)

          PointsY = Array(0, 11, 21, 33, 44, 21, 66.25714, 77, 88.3846, 99, 109)

          Set FatigueEvent2 = FatigueOptions2.AddFatigueEventForVariableAmplitude("Ready_Static", -0.002, 1, (PointsX), (PointsY), 0, 1#, errCode)

       

      I would want to write something like this but it is not working:

       

          PointsY = exApp.Worksheets("fatiguedata").Range("B2:B12")

       

      Anyone have any clues how to get this to work?