Hide Table of Contents

Get Properties of Sweep Feature Example (VBA)

This example shows how to get the properties of a sweep feature.

'------------------------------------------------------
' Preconditions:
' 1. Open public_documents\tutorial\api\cstick.sldprt.
' 2. Select Sweep1.
'
' Postconditions: Examine the Immediate area.
'
' NOTE: Because the part is used elsewhere, do not
' save changes.
'------------------------------------------------------
Option Explicit
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swSelMgr As SldWorks.SelectionMgr
    Dim swFeat As SldWorks.Feature
    Dim swSweep As SldWorks.SweepFeatureData
    Dim swProfFeat As SldWorks.Feature
    Dim swProfSketch As SldWorks.Sketch
    Dim swPathFeat As SldWorks.Feature
    Dim swPathSketch As SldWorks.Sketch
    Dim vGuideCurvesTypeArr As Variant
    Dim vGuideCurvesType As Variant
    Dim bRet As Boolean
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    Set swFeat = swSelMgr.GetSelectedObject5(1)
    Set swSweep = swFeat.GetDefinition
    ' Do not have to rollback to get sweep profile
    Set swProfFeat = swSweep.Profile
    Set swProfSketch = swProfFeat.GetSpecificFeature
    ' Rollback now
    bRet = swSweep.AccessSelections(swModel, Nothing)
    Set swPathFeat = swSweep.Path
    Set swPathSketch = swPathFeat.GetSpecificFeature
    vGuideCurvesTypeArr = swSweep.GetGuideCurvesType    'swSelectType_e
    ' TODO:  swSweep.GuideCurves
    ' TODO:  swSweep.StartDirectionVector
    ' TODO:  swSweep.EndDirectionVector
    Debug.Print "File = " & swModel.GetPathName
    Debug.Print "  " & swFeat.Name
    Debug.Print "    Path                   = " & swPathFeat.Name
    Debug.Print "    Profile                = " & swProfFeat.Name
    Debug.Print "    AdvancedSmoothing      = " & swSweep.AdvancedSmoothing
    Debug.Print "    AlignWithEndFaces      = " & swSweep.AlignWithEndFaces
    Debug.Print "    AutoSelect             = " & swSweep.AutoSelect
    Debug.Print "    EndTangencyType        = " & swSweep.EndTangencyType   'swTangencyType_e
    Debug.Print "    FeatureScope           = " & swSweep.FeatureScope
    Debug.Print "    FeatureScopeBodiesCnt  = " & swSweep.GetFeatureScopeBodiesCount
    If Not IsEmpty(vGuideCurvesTypeArr) Then
    Debug.Print "    Num GuideCurves        = " & UBound(vGuideCurvesTypeArr) + 1
        For Each vGuideCurvesType In vGuideCurvesTypeArr
    Debug.Print "      Type                 = " & vGuideCurvesType  'swSelectType_e
        Next vGuideCurvesType
    End If
    Debug.Print "    GetPathType            = " & swSweep.GetPathType       'swSelectType_e
    Debug.Print "    Wall thickness foward  = " & swSweep.GetWallThickness(True) * 1000# & " mm"
    Debug.Print "    Wall thickness reverse = " & swSweep.GetWallThickness(False) * 1000# & " mm"
    Debug.Print "    IsBossFeature          = " & swSweep.IsBossFeature
    Debug.Print "    IsThinFeature          = " & swSweep.IsThinFeature
    Debug.Print "    MaintainTangency       = " & swSweep.MaintainTangency
    Debug.Print "    Merge                  = " & swSweep.Merge
    Debug.Print "    MergeSmoothFaces       = " & swSweep.MergeSmoothFaces
    Debug.Print "    StartTangencyType      = " & swSweep.StartTangencyType 'swTangencyType_e
    Debug.Print "    TangentPropagation     = " & swSweep.TangentPropagation
    Debug.Print "    ThinWallType           = " & swSweep.ThinWallType
    Debug.Print "    TwistControlType       = " & swSweep.TwistControlType  'swTwistControlType_e
    ' Roll forward
    swSweep.ReleaseSelectionAccess
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 Properties of Sweep Feature 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) 2017 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.