Get Fixed Face of Flat-Pattern Feature Example (VBA)
This example shows how to get the fixed face of a flat-pattern feature.
'----------------------------------
'
' Preconditions: Sheet metal part is open and
' flat-pattern
feature is selected.
'
' Postconditions: None
'
'----------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSelMgr As
SldWorks.SelectionMgr
Dim
swFeat As
SldWorks.feature
Dim
swFlatPatt As
SldWorks.FlatPatternFeatureData
Dim
swFixedFace As
SldWorks.face2
Dim
bRet As
Boolean
Set
swApp = CreateObject("SldWorks.Application")
Set
swModel = swApp.ActiveDoc
Set
swSelMgr = swModel.SelectionManager
Set
swFeat = swSelMgr.GetSelectedObject5(1)
Set
swFlatPatt = swFeat.GetDefinition
'
Roll back part because flat pattern will absorb faces
bRet
= swFlatPatt.AccessSelections(swModel,
Nothing)
Set
swFixedFace = swFlatPatt.FixedFace
bRet
= swFixedFace.Select(False): Debug.Assert
bRet
'
Cancel any changes made
'swFlatPatt.ReleaseSelectionAccess
End Sub