0 Replies Latest reply on Feb 3, 2014 9:33 AM by Vincent Danilov

    Is it possible to have a "preview" on customized "section view method"

    Vincent Danilov

      Hi to everybody,

       

      the screenshot shows the cut view property manager and the preview upon calling the section view in solidworks.

       

      I would like to implement a customized section view method which would allow to select a cylinder (then take the center of the cylinder and create an appropriate reference plane there  ... the details of this are actually of no concern here - my question is a more general one).

       

      I recored with the macro recorder what was going on beneath the standard "section view" in solidworks - obviously the macro recorder can only eavesdrop on API calls after the OK-button  (the green tick) has been clicked:

       

      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 myModelView As Object

      Set myModelView = Part.ActiveView

      myModelView.FrameState = swWindowState_e.swWindowMaximized

      boolstatus = Part.Extension.SelectByID2("Vorne", "PLANE", 0, 0, 0, True, 1, Nothing, 0)

      Dim sViewData As Object

      Set sViewData = Part.ModelViewManager.CreateSectionViewData()

      Set sViewData.FirstPlane = Nothing

      sViewData.FirstReverseDirection = False

      sViewData.FirstOffset = -0.0975

      sViewData.FirstRotationX = 0.1221730476396

      sViewData.FirstRotationY = 0.08726646259972

      sViewData.FirstColor = 16711680

      sViewData.ShowSectionCap = True

      sViewData.KeepCapColor = False

      sViewData.GraphicsOnlySection = False

      boolstatus = Part.ModelViewManager.CreateSectionView(sViewData)

      Part.ClearSelection2 True

      End Sub

       

       

      If one calls the section view does some adjustments in the property manager and then cancels the property manager - then the macro recorder does not record much:

       

      ' ******************************************************************************

      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 myModelView As Object

      Set myModelView = Part.ActiveView

      myModelView.FrameState = swWindowState_e.swWindowMaximized

      boolstatus = Part.Extension.SelectByID2("Vorne", "PLANE", 0, 0, 0, True, 1, Nothing, 0)

      Part.ClearSelection2 True

      End Sub

       

       

      My question: Is it all somehow possible to have previews on customized methods in solidworks ?