Hide Table of Contents

Get Broken-Out Section Feature Data Example (VB.NET)

This example shows how to get broken-out section feature data from a drawing view.

' Preconditions: Open a drawing that contains a view with a broken-out
' section feature.
' Postconditions:
' 1. Inspect the Immediate window.
' 2. The radius of the broken-out section is increased.
' ---------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System
Imports System.Diagnostics

Partial Class SolidWorksMacro

Dim swDoc As ModelDoc2
Dim swDDoc As DrawingDoc
Dim swView As View
Dim varSheet As Object
    Dim varViews As Object
    Dim I As Long
    Dim J As Long
    Dim K As Long
    Dim swFeat As Feature
Dim swFeatData As BrokenOutSectionFeatureData
Dim swDepthRef As Entity
Dim varBS As Object
    Dim doRelease As Boolean
    Dim varskSeg As Object
    Dim segCtr As Long
    Dim segType As Long

    Sub main()
        swDoc = swApp.ActiveDoc
        swDDoc = swDoc
        varSheet = swDDoc.GetViews
For I = LBound(varSheet) To UBound(varSheet)
            varViews = varSheet(I)
For J = 1 To UBound(varViews) ' skip the sheet view
                Dim swView As View
                swView = varViews(J)
"View: " & swView.Name)
"  Number of broken-out sections in this view: " & swView.GetBreakOutSectionCount)
                varBS = swView.GetBreakOutSections
If (Not (IsNothing(varBS))) Then
                    For K = LBound(varBS) To UBound(varBS)
                        swFeat = varBS(K)
Call EditFeature(swFeat)
                        swFeatData = swFeat.GetDefinition
                        swDepthRef = swFeatData.DepthReference
' get and select depth reference, if set
                        If (swDepthRef Is Nothing) Then
                            Debug.Print("              Depth of exposure in meters: " & swFeatData.Depth)
End If
                        swFeatData =
                    Next K
End If
            Next J
Next I
End Sub

    Sub GetExistingValue()
        swFeatData.EditSketch =
        varskSeg = swFeatData.SketchSegment
If (Not (IsNothing(varskSeg))) Then
            Debug.Print("              Number of sketch segments: " & swFeatData.GetSketchSegmentCount)
End If
    End Sub

    Sub EditFeature(ByVal inFeat As Feature)
"      Iterating on broken-out section: " & inFeat.Name)

        swFeatData = inFeat.GetDefinition


If (doRelease = False) Then
            If (Not (IsNothing(varskSeg))) Then
                For segCtr = LBound(varskSeg) To UBound(varskSeg)
Dim swSeg As SketchSegment
                    swSeg = varskSeg(segCtr)
                    segType = swSeg.GetType
Select Case segType
Case swSketchSegments_e.swSketchLINE
Dim swSegLine As SketchLine
                            swSegLine = swSeg
"                  Segment type: Line")
                            swSegLine =
                        Case swSketchSegments_e.swSketchARC
Dim swSegArc As SketchArc
                            swSegArc = swSeg
"                  Segment type: Arc")
"                      Old radius: " & swSegArc.GetRadius)
Dim newRad As Double
                            newRad = swSegArc.GetRadius + 0.005
"                      New radius: " & newRad)
                            swSegArc =
                        Case Else
                            Debug.Print("                  Segment type: Unknown")
End Select
                Next segCtr
End If
            inFeat.ModifyDefinition(swFeatData, swDoc, Nothing)
End If
        varskSeg = Nothing
        swFeatData = Nothing
    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

Subject:   Feedback on Help Topics
Page:   Get Broken-Out Section Feature Data Example (VB.NET)
*   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:


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

Web Help Content Version: API Help (English only) 2013 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.