4 Replies Latest reply on Dec 6, 2013 12:30 AM by Sanjay Phadke

    convert entities property page manager

    Sanjay Phadke

      I am writing a macro where user select the hidden line in drawing view

      then user selects hidden line immediately after this I want to call convert entities property page manager

      so that line will be created on view

       

      Sub main()

       

      Set swApp = _

      Application.SldWorks

       

       

      Set Part = swApp.ActiveDoc

      Set swModel = swApp.ActiveDoc

       

       

      Set Part = swModel

       

       

      Set swModelDocExt = swModel.Extension

       

       

      Set swModelView = swModel.GetFirstModelView

       

       

      Set TheMouse = swModelView.GetMouse

       

       

      obj.init TheMouse

       

       

      Part.ClearSelection2 True

       

       

      swApp.SendMsgToUser "PLEASE SELECT THE VIEW"

       

       

      boolstatus = Part.ActivateView("")

      boolstatus = Part.Extension.SelectByID2("", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)

      Part.ViewDisplayHiddengreyed

       

      swApp.SendMsgToUser "SELECT THE LINE\LINES 2 CONVERT"

       

      '''''''here I want to call property page manager dialog''''''''''''''

       

      end sub

        • Re: convert entities property page manager
          Matt Martens

          If you use swapp.runcommand to access convert entities prior to making your selections the convert entities property manager will pop up (if you call convert entities after making a selection, it simply converts the entities without opening the PMP).

           

          boolstatus = Part.ActivateView("")

          boolstatus = Part.Extension.SelectByID2("", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)

          Part.ViewDisplayHiddengreyed

           

          swApp.RunCommand swCommands_ConvertEntities, ""

           

          swApp.SendMsgToUser "SELECT THE LINE\LINES 2 CONVERT"

           

          '''''''here I want to call property page manager dialog''''''''''''''

           

          end sub

           

          However, the macro will continue on without waiting for the command to finish. I tried to find out how to force the macro to wait for the completion of the command before resuming but was unsuccessful. Hopefully, someone else can come in and help with that part.

          • Re: convert entities property page manager
            Matt Martens

            I figured it out!

             

            Dim swApp As SldWorks.SldWorks

            Dim swmodel As SldWorks.ModelDoc2

            Dim boolstatus As Boolean

             

            Sub main()

             

            Set swApp = Application.SldWorks

            Set swmodel = swApp.ActiveDoc

            swApp.RunCommand swCommands_ConvertEntities, ""

            swApp.SendMsgToUser "SELECT THE LINE\LINES 2 CONVERT"

             

            Do

              swApp.GetRunningCommandInfo 0, 0, boolstatus

              DoEvents

            Loop While boolstatus = True

             

            End Sub

             

            The do while loop will run and allow the user to select any lines, but as soon as the property manager's check or cancel buttons are pressed the loop ends and moves on.

              • Re: convert entities property page manager
                Sanjay Phadke

                instead of this swApp.RunCommand swCommands_ConvertEntities, ""

                 

                 

                use following

                 

                Set swSketchManager = swModel.SketchManager

                        boolstatus = swSketchManager.SketchUseEdge2(False)

                 

                it works well

                 

                But I want now after converting the entities view selection should be remained but it is not happening

                after end function view selection does not remain, pls guide me

                 

                sub function test()

                 

                Set VW = Part.ActiveDrawingView

                VW.SetDisplayMode 2

                boolstatus = Part.Extension.SelectByID2("", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)

                 

                end function