8 Replies Latest reply on May 16, 2013 3:22 AM by Simon Turner

    Pause Macro then......

    Denten McDougall

      I have a macro that I have written a few years ago that puts a flat pattern part on a drawing template then saves it as a dxf.  certain parts require specific grain directions so I am trying to modify this macro to pause after the part is put on the drawing template to allow the user to roatate the view so that the orientation is correct and then continue to save the dxf and end the macro.

       

      This is proving to be more trouble than I thought and am looking for opinions on how to make this work.  what I have noticed is that if I run the macro from a button on the toolbar, Solidworks becomes unresponsive while tha macro is running or is paused by a break in the code, so i cannot manipulate the view.  but if i execute the macro from the VB edit window this does not happen?  so I need to solve that problem.

       

      what I was attempting to do was create a while loop in the program and have it loop until I get the modification made and tell it to continure.  this is what I have..

       

      If swModel.CustomInfo2(ConfigName, "Grain") = -1 Then
        continue = False   
      Else
          continue = True
      End If


      While continue = False
              Sleep (100)
              DoEvents
      Wend

       

      the problem is, that I can't figure out how to get out of this loop by flipping continue to true.  I thought maybe I could do it by firing another macro to flip this but I can't seem to do that.

       

      Thoughts.....please