Hide Table of Contents

Create Thicken Feature Example (VBA)

This example shows how to create a thicken feature in a multibody part.

'-------------------------------------------------------------------
' Preconditions:
' 1. Open public_documents\samples\tutorial\multibody\multi_local.sldprt.
' 2. Open the Immediate window.
'
' Postconditions:
' 1. Creates an offset plane and offset surface.
' 2. Selects a face on one body and the offset surface.
' 3. Creates a thicken feature.
' 4. Accesses the thicken feature and gets some property values.
' 5. Examine the graphics area and Immediate window.
'
' NOTE: Because the part is used elsewhere, do not save changes.
'-------------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swRefPlane As SldWorks.RefPlane
Dim swFeatureMgr As SldWorks.FeatureManager
Dim swPlane As SldWorks.RefPlane
Dim swFeatureThicken As SldWorks.Feature
Dim swFeatureThicken_DEF As SldWorks.ThickenFeatureData
Dim status As Boolean
Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swModelDocExt = swModel.Extension    
    'Create offset surface
    status = swModelDocExt.SelectByID2("Top", "PLANE", 0, 0, 0, True, 0, Nothing, 0)
    Set swFeatureMgr = swModel.FeatureManager
    Set swRefPlane = swFeatureMgr.InsertRefPlane(264, 0.01, 0, 0, 0, 0)
    swModel.ClearSelection2 True
    status = swModelDocExt.SelectByID2("", "FACE", 2.35573770133328E-02, 0, -2.4476412300487E-03, False, 0, Nothing, 0)
    status = swModelDocExt.SelectByID2("", "FACE", -5.61529049190312E-02, 0, -2.56278005667809E-03, True, 0, Nothing, 0)
    swModel.InsertOffsetSurface 0.01, False    
    swModel.ClearSelection2 True    
    status = swModelDocExt.SelectByID2("Extrude1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
    status = swModelDocExt.SelectByID2("Surface-Offset1[1]", "SURFACEBODY", 3.19724221122328E-02, -9.99999999999091E-03, -1.04277742429417E-02, False, 1, Nothing, 0)
    ' Thicken the selected reference surface and then generate a boss
    Set swFeatureThicken = swFeatureMgr.FeatureBossThicken(0.01, 0, 96, False, True, False, True)
    swModel.ClearSelection2 True   
    ' Set the property values for the selected feature
    swModel.SelectedFeatureProperties 0, 0, 0, 0, 0, 0, 0, 1, 0, "Thicken1"
  
    ' Get the thicken feature definition object
    Set swFeatureThicken_DEF = swFeatureThicken.GetDefinition
    swFeatureThicken_DEF.AccessSelections swModel, Nothing    
    ' Display whether a boss feature
    Debug.Print "Boss feature? " & swFeatureThicken_DEF.IsBossFeature    
    ' Display whether the results of this thicken feature are merged
    Debug.Print "Merged? " & swFeatureThicken_DEF.Merge    
    ' Display whether all or only specific bodies were
    ' automatically selected for the thicken feature
    Debug.Print "All bodies automatically selected? " & swFeatureThicken_DEF.AutoSelect    
    swFeatureThicken_DEF.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:   Create Thicken 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) 2019 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.