Hide Table of Contents

Get Section Properties for Planar Faces Example (VBA)

This example shows how to get section properties for planar faces.

 

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

'

' Preconditions: A part is open that has at least three planar faces.

'

' Postconditions: None

'

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

Option Explicit

 

Dim swApp As SldWorks.SldWorks

Dim swModelDoc As SldWorks.ModelDoc2

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swSelMgr As SldWorks.SelectionMgr

Dim boolstatus As Boolean

 

Sub main()

Set swApp = Application.SldWorks

Set swModelDoc = swApp.ActiveDoc

Set swModelDocExt = swModelDoc.Extension

Set swSelMgr = swModelDoc.SelectionManager

boolstatus = swModelDocExt.SelectByID2("", "FACE", 0.01003412456834, -0.004066490524281, 0.009999999999877, False, 0, Nothing, swSelectOptionDefault)

Dim face1(0 To 0) As Object

Set face1(0) = swSelMgr.GetSelectedObject5(1)

swModelDoc.ClearSelection2 True

Dim vFace1 As Variant

vFace1 = face1

Dim v1 As Variant

' Get the section properties for the selected face

v1 = swModelDocExt.GetSectionProperties2((vFace1))

Dim i As Integer

For i = 0 To UBound(v1)

    Debug.Print v1(i)

Next i

 

boolstatus = swModelDocExt.SelectByID2("", "FACE", 0.06206582466552, -0.001327173848324, 0.003390017181914, False, 0, Nothing, swSelectOptionDefault)

Dim face2(0 To 0) As Object

Set face2(0) = swSelMgr.GetSelectedObject5(1)

swModelDoc.ClearSelection2 True

Dim vFace2 As Variant

vFace2 = face2

Dim v2 As Variant

' Get the section properties for the selected face

v2 = swModelDocExt.GetSectionProperties2((vFace2))

For i = 0 To UBound(v1)

    Debug.Print v1(i)

Next i

 

boolstatus = swModelDocExt.SelectByID2("", "FACE", 0.001167899978725, 0.01888959881109, 0.005119132501591, False, 0, Nothing, swSelectOptionDefault)

Dim face3(0 To 0) As Object

Set face3(0) = swSelMgr.GetSelectedObject5(1)

swModelDoc.ClearSelection2 True

Dim vFace3 As Variant

vFace3 = face3

Dim v3 As Variant

' Get the section properties for the selected face

v3 = swModelDocExt.GetSectionProperties2((vFace3))

For i = 0 To UBound(v1)

    Debug.Print v1(i)

Next i

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 Properties for Planar Faces 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) 2015 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.