Hide Table of Contents

Get Section View Data Example (VBA)

This example shows how to get the data of a section view.

 

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

'

' Preconditions: Part or assembly document is open in

'                which a section view exists.

'

' Postconditions: None

'

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

Option Explicit

 

Sub main()

 

    Dim swApp As SldWorks.SldWorks

    Dim swModel As SldWorks.ModelDoc2

    Dim swModelViewMgr As SldWorks.ModelViewManager

    Dim rSVData As SldWorks.SectionViewData

    Dim swSelMgr As SldWorks.SelectionMgr

    Dim boolstatus As Boolean

    

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager

    Set swModelViewMgr = swModel.ModelViewManager

    Set rSVData = swModelViewMgr.GetSectionViewData("")

    

    swModel.ClearSelection2 True

    

    DisplayDebugInformation rSVData, swSelMgr

    

End Sub

 

'Select the planes and print the rest

Sub DisplayDebugInformation(data As SectionViewData, selMgr As SelectionMgr)

    Dim p1 As Object

    Dim p2 As Object

    Dim p3 As Object

    

    Set p1 = data.FirstPlane

    If Not p1 Is Nothing Then p1.Select True

    

    Set p2 = data.SecondPlane

    If Not p2 Is Nothing Then p2.Select True

    

    Set p3 = data.ThirdPlane

    If Not p3 Is Nothing Then p3.Select True

       

    Debug.Print "----------Box 1----------"

    Debug.Print "Offset         " & data.FirstOffset

    Debug.Print "Rotation X     " & data.FirstRotationX

    Debug.Print "Rotation Y     " & data.FirstRotationY

    Debug.Print "Color          " & data.FirstColor

    Debug.Print "Reverse Dir    " & data.FirstReverseDirection

    

    Debug.Print "----------Box 2----------"

    Debug.Print "Offset         " & data.SecondOffset

    Debug.Print "Rotation X     " & data.SecondRotationX

    Debug.Print "Rotation Y     " & data.SecondRotationY

    Debug.Print "Color          " & data.SecondColor

    Debug.Print "Reverse Dir    " & data.SecondReverseDirection

    

    Debug.Print "----------Box 3----------"

    Debug.Print "Offset         " & data.ThirdOffset

    Debug.Print "Rotation X     " & data.ThirdRotationX

    Debug.Print "Rotation Y     " & data.ThirdRotationY

    Debug.Print "Color          " & data.ThirdColor

    Debug.Print "Reverse Dir    " & data.ThirdReverseDirection

    

    Debug.Print "----------Show Section Cap----------"

    Debug.Print "Show Section Cap   " & data.ShowSectionCap

 

End Sub



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 Section View Data Example (VBA)
*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) 2010 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.