Hide Table of Contents

Convert Extrusion to Sheet Metal Example (VBA)

This example shows how to convert a solid body to sheet metal.

' Preconditions:
' 1. Open <SolidWorks_install_dir>\samples\tutorial\api\sweepcutextrude.sldprt.
' 2. Open an Immediate Window.
' Postconditions:
' 1. Boss-Extrude1 is converted to sheet metal containing two rip edges.
' 2. The FeatureManager design tree now contains:
'        * Sheet-Metal1
'        * Convert-Solid1
'        * Flat-Pattern1

' NOTE: Because the part is used in SolidWorks tutorials,

' do not save any changes to it.

Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SelectByID2("", "FACE", 4.130570195002E-04, 0.02357994168921, 0.02568415695742, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", -0.00190522473838, 0.02387533864419, 0.04979931166838, True, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.02911271681069, 0.02376277320678, 0.02892436699148, True, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", -0.004838857104858, 0.02387396382323, -1.997542986487E-04, True, 1, Nothing, 0)


' Convert extrusion to sheet metal of thickness=13mm, bend radius=0.5mm, rip gap=2mm,

' relief type = rectangular, relief ratio = 0.5, rip edge overlap type = open butt,

' and rip edge overlap ratio = 0.5, do not keep bodies
boolstatus = Part.FeatureManager.InsertConvertToSheetMetal2(0.013, False, False, 0.0005, 0.002, 0, 0.5, 1, 0.5, false)

Part.ClearSelection2 True
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

Subject:   Feedback on Help Topics
Page:   Convert Extrusion to Sheet Metal Example (VBA)
*   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) 2014 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.