Hide Table of Contents

Change Wrap Feature Face Example (VBA)

This example shows how to change the face on which to apply a wrap feature.

 

'----------------------------------------------------------------

'

' Preconditions:

'           (1) Part document is open.

'           (2) Part contains a wrap feature.

'

' Postcondtions: Face where wrap feature applied has changed.

'

'-----------------------------------------------------------------

Option Explicit

 

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swComponent As SldWorks.Component2

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swSelMgr As SldWorks.SelectionMgr

Dim swFace As SldWorks.face2

Dim swModelView As SldWorks.ModelView

Dim boolstatus As Boolean

Dim longstatus As Long

Dim longwarnings As Long

Dim swWrapFeatureData As SldWorks.WrapSketchFeatureData

Dim swWrapFeature As Feature

 

Sub rotate_part_first()

    swModelView.RotateAboutCenter 0.00539119, 0

    swModelView.RotateAboutCenter 0.0107824, -0.012062

    swModelView.RotateAboutCenter 0.0215648, -0.0361859

    swModelView.RotateAboutCenter 0.0161736, -0.0422169

    swModelView.RotateAboutCenter 0.0107824, -0.0301549

    swModelView.RotateAboutCenter 0.0107824, -0.0542788

    swModelView.RotateAboutCenter 0.00539119, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0241239

    swModelView.RotateAboutCenter 0, -0.0422169

    swModelView.RotateAboutCenter 0, -0.0482478

    swModelView.RotateAboutCenter 0, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0542788

    swModelView.RotateAboutCenter 0, -0.0361859

    swModelView.RotateAboutCenter 0, -0.0663408

    swModelView.RotateAboutCenter 0, -0.0663408

    swModelView.RotateAboutCenter 0, -0.0361859

    swModelView.RotateAboutCenter 0, -0.0482478

    swModelView.RotateAboutCenter 0, -0.0663408

    swModelView.RotateAboutCenter -0.00539119, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0603098

    swModelView.RotateAboutCenter 0, -0.0301549

    swModelView.RotateAboutCenter -0.00539119, -0.0241239

    swModelView.RotateAboutCenter -0.00539119, -0.0542788

    swModelView.RotateAboutCenter 0, -0.0542788

    swModelView.RotateAboutCenter 0, -0.0241239

    swModelView.RotateAboutCenter -0.00539119, -0.0542788

    swModelView.RotateAboutCenter -0.00539119, -0.0422169

    swModelView.RotateAboutCenter 0, -0.0180929

    swModelView.RotateAboutCenter -0.00539119, -0.0422169

    swModelView.RotateAboutCenter -0.00539119, -0.0241239

    swModelView.RotateAboutCenter 0, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0241239

    swModelView.RotateAboutCenter 0, -0.00603098

    swModelView.RotateAboutCenter 0, -0.012062

End Sub

Sub rotate_part_second()

    swModelView.RotateAboutCenter 0, -0.00603098

    swModelView.RotateAboutCenter 0, -0.00603098

    swModelView.RotateAboutCenter 0, -0.00603098

    swModelView.RotateAboutCenter 0, -0.012062

    swModelView.RotateAboutCenter 0.00539119, -0.0482478

    swModelView.RotateAboutCenter 0, -0.0663408

    swModelView.RotateAboutCenter 0, -0.0241239

    swModelView.RotateAboutCenter 0, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0241239

    swModelView.RotateAboutCenter -0.0215648, -0.0723718

    swModelView.RotateAboutCenter -0.0161736, -0.0603098

    swModelView.RotateAboutCenter -0.00539119, -0.0301549

    swModelView.RotateAboutCenter -0.0107824, -0.0241239

    swModelView.RotateAboutCenter -0.0215648, -0.0663408

    swModelView.RotateAboutCenter -0.0107824, -0.0241239

    swModelView.RotateAboutCenter -0.0107824, -0.0482478

    swModelView.RotateAboutCenter -0.0107824, -0.0241239

    swModelView.RotateAboutCenter -0.00539119, -0.0301549

    swModelView.RotateAboutCenter -0.0161736, -0.0603098

    swModelView.RotateAboutCenter -0.0107824, -0.0301549

    swModelView.RotateAboutCenter -0.0161736, -0.0964957

    swModelView.RotateAboutCenter -0.0161736, -0.114589

    swModelView.RotateAboutCenter -0.00539119, -0.0603098

    swModelView.RotateAboutCenter -0.0107824, -0.0361859

    swModelView.RotateAboutCenter -0.00539119, -0.0361859

    swModelView.RotateAboutCenter -0.0107824, -0.205053

    swModelView.RotateAboutCenter -0.00539119, -0.0844337

    swModelView.RotateAboutCenter -0.00539119, -0.0603098

    swModelView.RotateAboutCenter -0.0107824, -0.0603098

    swModelView.RotateAboutCenter -0.00539119, -0.0301549

    swModelView.RotateAboutCenter 0, -0.0422169

    swModelView.RotateAboutCenter -0.00539119, -0.012062

    swModelView.RotateAboutCenter 0, -0.00603098

    swModelView.RotateAboutCenter 0, -0.0180929

    swModelView.RotateAboutCenter 0, -0.00603098

    swModelView.RotateAboutCenter 0.00539119, 0

    swModelView.RotateAboutCenter 0.0107824, 0

    swModelView.RotateAboutCenter 0.0161736, 0

    swModelView.RotateAboutCenter 0.0107824, 0

    swModelView.RotateAboutCenter 0.0161736, 0.00603098

    swModelView.RotateAboutCenter 0.0215648, 0

    swModelView.RotateAboutCenter 0.00539119, 0

    swModelView.RotateAboutCenter 0.0215648, 0.00603098

    swModelView.RotateAboutCenter 0.0161736, 0

    swModelView.RotateAboutCenter 0.0269559, 0.012062

    swModelView.RotateAboutCenter 0.0161736, 0

    swModelView.RotateAboutCenter 0.0107824, 0.00603098

    swModelView.RotateAboutCenter 0.0161736, 0.0180929

    swModelView.RotateAboutCenter 0.00539119, 0.00603098

    swModelView.RotateAboutCenter 0.0161736, 0.012062

    swModelView.RotateAboutCenter 0.00539119, 0.012062

    swModelView.RotateAboutCenter 0.00539119, 0.00603098

    swModelView.RotateAboutCenter 0.0215648, 0.0361859

    swModelView.RotateAboutCenter 0.0107824, 0.0180929

    swModelView.RotateAboutCenter 0.0107824, 0.012062

    swModelView.RotateAboutCenter 0.0107824, 0.012062

    swModelView.RotateAboutCenter 0, 0.00603098

    swModelView.RotateAboutCenter 0.00539119, 0.00603098

End Sub

Sub main()

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swModelDocExt = swModel.Extension

    Set swSelMgr = swModel.SelectionManager

    Set swModelView = swModel.ActiveView

    

    Call rotate_part_first

    

    boolstatus = swModelDocExt.SelectByID2("", "FACE", 0.01587026909715, 0.008305383951679, 0.11, False, 0, Nothing, swSelectDefaultOption)

    Set swFace = swSelMgr.GetSelectedObject5(1)

    swModel.ClearSelection2 True

    swModel.ShowNamedView2 "*Isometric", 7

    

    Set swWrapFeature = swModel.FeatureByName("Wrap1")

    

    Set swWrapFeatureData = swWrapFeature.GetDefinition

    

    boolstatus = swWrapFeatureData.AccessSelections(swModel, Nothing)

    

    swWrapFeatureData.Face = swFace

        

    boolstatus = swWrapFeature.ModifyDefinition(swWrapFeatureData, swModel, Nothing)

    

    swModel.ShowNamedView2 "*Isometric", 7

    Call rotate_part_second

    

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:   Change Wrap Feature Face 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) 2012 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.