Hide Table of Contents

Insert Wrap Feature Example (VBA)

This example shows how to insert a wrap feature.

'-----------------------------------------------------------------------
' Preconditions: Open public_documents\tutorial\api\cylinder20.sldprt.
'
' Postconditions:
' 1. Selects the Front plane and creates a sketch of a circle.
' 2. Selects the sketch and nonplanar face.
' 3. Inserts a wrap feature on the selected nonplanar face.
' 4. Examine the graphics area and FeataureManager design
'    tree.
'
' 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 boolstatus As Boolean
Dim swFeatMgr As SldWorks.FeatureManager
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSketchSegment As SldWorks.SketchSegment
Dim swSketchManager As SldWorks.SketchManager
Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swModelDocExt = swModel.Extension
    Set swSketchManager = swModel.SketchManager    
    'Create sketch for wrap feature
    swSketchManager.InsertSketch True
    boolstatus = swModelDocExt.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
    Set swSketchSegment = swSketchManager.CreateCircle(-0.006377, 0.026536, 0#, 0.004153, 0.006985, 0#)
    swSketchManager.InsertSketch True    
    swModel.ClearSelection2 True    
    ' Mark the sketch to use for wrap feature as 4
    boolstatus = swModelDocExt.SelectByID2("Sketch2", "SKETCH", 0, 0, 0, True, 4, Nothing, swSelectOptionDefault)    
    ' Mark the nonplanar face on which to place wrap feature as 1
    boolstatus = swModelDocExt.SelectByID2("", "FACE", -2.01300616999447E-02, 2.48040612188447E-02, 5.80282618765864E-02, True, 1, Nothing, 0)
    Set swFeatMgr = swModel.FeatureManager    
    ' Create a wrap feature of type emboss
    swFeatMgr.InsertWrapFeature 0, 0.005, False    
    swModel.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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Insert Wrap 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.