Hide Table of Contents

Enable Contour Selection Example (VB.NET)

This example shows how to select the contour of a sketch region and extrude the selected region.

'----------------------------------------------------------------------------
' Preconditions: Ensure that the specified document template exists.
'
' Postconditions: The selected sketch region is extruded.
' ---------------------------------------------------------------------------

Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System

Partial Class SolidWorksMacro

    
Dim swModel As ModelDoc2
    
Dim vSkLines As Object
    Dim boolstatus As Boolean


    Sub main()

        swModel = swApp.NewDocument(
"C:\ProgramData\SOLIDWORKS\SOLIDWORKS 2014\templates\Part.prtdot", 0, 0, 0)
        swModel = swApp.ActiveDoc
        boolstatus = swModel.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayOrigins,
True)
        swModel.ClearSelection2(
True)

        vSkLines = swModel.SketchManager.CreateCornerRectangle(-0.0390769010920735, 0.0405984975017191, 0, 0.0129020232818107, -0.0166534302871355, 0)
        swModel.ClearSelection2(
True)
        vSkLines = swModel.SketchManager.CreateCornerRectangle(-0.00751826843645631, 0.0156092594749566, 0, 0.0487922329685375, -0.041704950991857, 0)
        swModel.ClearSelection2(
True)
        swModel.SketchManager.InsertSketch(
True)

        
' Enable contour selection
        swModel.SelectionManager.EnableContourSelection = True
        ' Select a contour to extrude
        swModel.Extension.SelectByID2("Sketch1", "SKETCHREGION", 0, 0.01, 0, True, 4, Nothing, 0)
        swModel.FeatureManager.FeatureExtrusion3(
True, False, False, 0, 0, 0.01, 0.01, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
        
' Disable contour selection
        swModel.SelectionManager.EnableContourSelection = False
        swModel.ClearSelection2(True)

    
End Sub

    
    
Public swApp As SldWorks


End Class

 



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:   Enable Contour Selection Example (VB.NET)
*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) 2022 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.