Hide Table of Contents

Get Weld Bead Symbol Data Example (VB.NET)

This example shows how to get weld bead symbol data in a drawing.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Open a drawing that contains at least one view with a weld bead
'    annotation.
' 2. Open an Immediate window.
'
' Postconditions: Inspect the Immediate window.
'----------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
Imports System.Diagnostics
 
Partial Class SolidWorksMacro
 
    Sub main()
 
        Dim swModel As ModelDoc2
        Dim swDraw As DrawingDoc
        Dim swSheet As Sheet
        Dim swView As View
        Dim swWBead As WeldBead
        Dim swDispData As DisplayData
        Dim strFilled As String
        Dim lineCount As Integer
        Dim vLine As Object
        Dim lineColor As Integer, lineLineType As Integer, lineStyle As Integer, lineWeight As Integer
        Dim lineX As Double, lineY As Double, lineZ As Double
        Dim polygonCount As Integer
        Dim vPolygon As Object
        Dim polyColor As Integer, polyLineType As Integer, polyNumPts As Integer
        Dim polyX As Double, polyY As Double, polyZ As Double
        Dim index As Integer, index2 As Integer, arrayIndex As Integer
 
        swModel = swApp.ActiveDoc
        swDraw = swModel
        swSheet = swDraw.GetCurrentSheet
        swView = swDraw.GetFirstView
 
        While Not swView Is Nothing
 
            Debug.Print(swView.Name)
            swWBead = swView.GetFirstWeldBead()
 
            While Not swWBead Is Nothing
 
                Debug.Print("  Weld Bead...")
                If (swWBead.SolidFill = FalseThen
                    strFilled = "open"
                Else
                    strFilled = "solid filled"
                End If
 
                swDispData = swWBead.GetAnnotation().GetDisplayData()
                lineCount = swDispData.GetLineCount
                Debug.Print("    Line count = " & lineCount)
 
                For index = 0 To lineCount - 1
                    vLine = swDispData.GetLineAtIndex3(index)
                    If Not IsNothing(vLine) Then
                        lineColor = vLine(0)
                        lineLineType = vLine(1)
                        lineStyle = vLine(2)
                        lineWeight = vLine(3)
                        Debug.Print("      Color = " & lineColor & ", line type = " & lineLineType & ", line style = " & lineStyle & ", line weight = " & lineWeight)
                        arrayIndex = 4
                        For index2 = 0 To 1
                            lineX = vLine(arrayIndex)
                            lineY = vLine(arrayIndex + 1)
                            lineZ = vLine(arrayIndex + 2)
                            Debug.Print("       " & index2 & " (" & lineX & ", " & lineY & ", " & lineZ & ")")
                            arrayIndex = arrayIndex + 3
                        Next index2
                    End If
                Next index
 
                Debug.Print("    Polyline count = " & swDispData.GetPolyLineCount)
                Debug.Print("    Arc count = " & swDispData.GetArcCount)
                polygonCount = swDispData.GetPolygonCount
                Debug.Print("    Polygon count = " & polygonCount)
 
                For index = 0 To polygonCount - 1
                    vPolygon = swDispData.GetPolygonAtIndex(index)
                    If Not IsNothing(vPolygon) Then
                        polyColor = vPolygon(0)
                        polyLineType = vPolygon(1)
                        polyNumPts = vPolygon(4)
                        Debug.Print("      Color = " & polyColor & ", line type = " & polyLineType & ", point count = " & polyNumPts & ", " & strFilled)
                        arrayIndex = 5
 
                        For index2 = 0 To polyNumPts - 1
                            polyX = vPolygon(arrayIndex)
                            polyY = vPolygon(arrayIndex + 1)
                            polyZ = vPolygon(arrayIndex + 2)
                            Debug.Print("       " & index2 & " (" & polyX & ", " & polyY & ", " & polyZ & ")")
                            arrayIndex = arrayIndex + 3
                        Next index2
                    End If
                Next index
                swWBead = swWBead.GetNext()
            End While
            swView = swView.GetNextView
        End While
 
    End Sub
 
 
    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 Weld Bead Symbol Data 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) 2016 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.