Hide Table of Contents

Get Solid-fill Hatch Information Example (VB.NET)

This example shows how to get information about solid-fill hatches in a detail view in the current drawing sheet.

'----------------------------------

' Preconditions:

' 1. Open a SolidWorks drawing that has a

'    solid-fill hatch in a detail view.

' 2. Run the macro and examine the Immediate window

'    and drawing document to verify the results.

'

' Postconditions: None

'----------------------------------

Imports SolidWorks.Interop.sldworks

Imports SolidWorks.Interop.swconst

Imports System

Imports System.Diagnostics

 

Partial Class SolidWorksMacro

 

    Public Sub main()

 

        Dim swModel As ModelDoc2

        Dim swDrawing As DrawingDoc

        Dim swSheet As Sheet

        Dim swView As View

        Dim nbrSolidFillHatches As Long

        Dim ArraySize As Long

        Dim i As Long

        Dim boundaryData As Object

 

        swModel = swApp.ActiveDoc

        swDrawing = swModel

 

        ' Get drawing sheet

        swSheet = swDrawing.GetCurrentSheet

        ' Get name of drawing sheet

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

 

        ' First view is the current drawing sheet

        swView = swDrawing.GetFirstView

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

        ' Get first drawing view on drawing sheet

        swView = swView.GetNextView

        nbrSolidFillHatches = 0

        ArraySize = 0

 

        While Not swView Is Nothing

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

            Debug.Print("            View name: " & swView.Name)

            nbrSolidFillHatches = swView.GetSolidHatchCount(ArraySize)

            Debug.Print("            Number of solid-fill hatches in this view: " & nbrSolidFillHatches)

            Debug.Print("            Size of array for the boundary data for the solid-fill hatch(es): " & ArraySize)

            If ArraySize > 0 Then

                boundaryData = swView.GetSolidHatchInfo

                Debug.Print("                          Is the loop an outer loop (first)? " & boundaryData(0))

                Debug.Print("                          Number of polylines in loop: " & boundaryData(1))

                Debug.Print("                          Type ( 0 = polyline; 1 = arc or circle): " & boundaryData(2))

                Debug.Print("                          Size of geometric data array (will be 0 if Type = 0): " & boundaryData(3))

                Debug.Print("                              See IView::GetSolidHatchInfo's API Help topic for descriptions of these array elements: ")

                For i = 4 To ArraySize - 1

                    Debug.Print("                                            Boundary data, array element " & i & ": " & boundaryData(i))

                Next i

            End If

            ' Get next drawing view

            swView = swView.GetNextView

        End While

 

    End Sub

 

    ''' <summary>

    ''' The SldWorks swApp variable is pre-assigned for you.

    ''' </summary>

    Public swApp As SldWorks

 

End Class



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Get Solid-fill Hatch Information Example (VB.NET)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2011 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.