3 Replies Latest reply on Sep 25, 2014 2:59 PM by Jesse Seger

    How to position crop views in 2D Drawing

    Di Anne

      Hi,

       

      Does anyone knows how to position crop views in 2D Drawing?

       

      Im using swView.Position in positioning my views but when that view

      is cropped swView.Position doesn't seem work.

       

      Thanks in advance.

        • Re: How to position crop views in 2D Drawing
          Jesse Seger

          It works for me.  Even if it is cropped.

           

          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2

          Dim swDrawing As SldWorks.DrawingDoc

          Dim swSheet As SldWorks.Sheet

          Dim swView As SldWorks.View

          Dim i As Long

           

           

          Sub main()

           

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swDrawing = swModel

           

          ' Get drawing sheet

          Set swSheet = swDrawing.GetCurrentSheet

           

           

          ' Get name of drawing sheet

          Debug.Print "Name of drawing sheet: " & swSheet.GetName

           

           

          ' Get number of views on drawing sheet

          Debug.Print "  Number of drawing views on drawing sheet: " & swDrawing.GetViewCount

           

           

          ' First view is the current drawing sheet

          Set swView = swDrawing.GetFirstView

           

           

          Debug.Print "    First drawing view is the current drawing sheet, so..."

           

           

          ' Get first drawing view on drawing sheet

          Set swView = swView.GetNextView

           

           

          While Not swView Is Nothing

           

           

              Debug.Print "        Get next drawing view on drawing sheet..."

           

              Dim pos(2) As Double

              pos(0) = 0

              pos(1) = 0.1

           

              swView.Position = pos

           

           

              ' Get next drawing view

              Set swView = swView.GetNextView

           

          Wend

           

          End Sub