2 Replies Latest reply on Aug 10, 2013 8:52 PM by Jin Fui Chong

    API to Disable screen updating in Motion Study

    Jin Fui Chong

      Is there any API to disable the graphics update/ Screen update of motion study in solidworks ? What I want to do is whenever i am doing some operation through my code, User should not see those  explicitly. It should happen it in the back end.

          • Re: API to Disable screen updating in Motion Study
            Jin Fui Chong

            Hi, Artem

             

            i tried this EnableGraphicsUpdate before by making it equal to false. But it was not working in motion study. Here is my API:

             

             

             

            Sub main()

             

            Set swApp = _

            Application.SldWorks

            EnableGraphicsUpdate = False

            ISldWorks:: DocumentVisible = False

            Set Part = swApp.ActiveDoc

            Dim motionStudyMgr As Object

            Set motionStudyMgr = Part.Extension.GetMotionStudyManager()

            Dim myMotionStudy As Object

            Set myMotionStudy = motionStudyMgr.GetMotionStudy("Motion Study 1")

            boolstatus = myMotionStudy.SetTime(1 / 28)

            boolstatus = Part.Extension.SelectByID2("Distance from origin1", "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditUnsuppress2

            Part.ClearSelection2 True

            boolstatus = Part.Extension.SelectByID2("Angle of left wing (horizontal)1", "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditUnsuppress2

            Part.ClearSelection2 True

            boolstatus = Part.Extension.SelectByID2("Angle of right wing (horizontal)1", "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditUnsuppress2

            Part.ClearSelection2 True

             

            Dim i As Integer

            i = 1

            For i = 1 To 50

            Set motionStudyMgr = Part.Extension.GetMotionStudyManager()

            Set myMotionStudy = motionStudyMgr.GetMotionStudy("Motion Study 1")

            boolstatus = myMotionStudy.SetTime(i / 28)

            boolstatus = Part.Extension.SelectByID2("Distance from origin" & i, "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditSuppress2

            Part.ClearSelection2 True

            boolstatus = Part.Extension.SelectByID2("Distance from origin" & i + 1, "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditUnsuppress2

            Part.ClearSelection2 True

            boolstatus = Part.Extension.SelectByID2("Angle of left wing (horizontal)" & i, "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditSuppress2

            Part.ClearSelection2 True

            boolstatus = Part.Extension.SelectByID2("Angle of left wing (horizontal)" & i + 1, "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditUnsuppress2

            Part.ClearSelection2 True

            boolstatus = Part.Extension.SelectByID2("Angle of right wing (horizontal)" & i, "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditSuppress2

            Part.ClearSelection2 True

            boolstatus = Part.Extension.SelectByID2("Angle of right wing (horizontal)" & i + 1, "MATE", 0, 0, 0, False, 0, Nothing, 0)

            Part.EditUnsuppress2

            Part.ClearSelection2 True

             

             

             

             

            Next i

             

             

            boolstatus = myMotionStudy.Calculate()

            EnableGraphicsUpdate = True

            ISldWorks:: DocumentVisible = True

             

             

            End Sub