Hello everybody,
I have a sheetmetal part,
I want to get the fixed face of a flat-pattern feature and then get its edges,
I select the flat-pattern feature and I execute this code
Dim swApp As SldWorks
Dim swDoc As ModelDoc2
Dim swSelMgr As SelectionMgr
Dim boolstatus As Boolean
Dim swSelObj As Object
Dim swFeat As Feature
Dim swFlatPatt As FlatPatternFeatureData
Dim swFixedFace As Face2
Dim swEdges() As Object
Dim newState As Integer
Try
swApp = CreateObject("SldWorks.Application")
swDoc = swApp.ActiveDoc
swSelMgr = swDoc.SelectionManager
swSelObj = swSelMgr.GetSelectedObject6(1, -1)
boolstatus = TypeOf swSelObj Is Feature
If Not boolstatus Then Exit Sub
swFeat = swSelObj
If Not "FlatPattern".Equals(swFeat.GetTypeName2()) Then Exit Sub
If swFeat.IsSuppressed2(swInConfigurationOpts_e.swThisConfiguration, "")(0) Then
newState = swFeatureSuppressionAction_e.swUnSuppressFeature
swFeat.SetSuppression2(newState, swInConfigurationOpts_e.swThisConfiguration, "")
End If
swFlatPatt = swFeat.GetDefinition()
boolstatus = swFlatPatt.AccessSelections(swDoc, Nothing)
If Not boolstatus Then Exit Sub
swFixedFace = swFlatPatt.FixedFace
swFlatPatt.ReleaseSelectionAccess()
swEdges = swFixedFace.GetEdges()
Console.WriteLine("Done !!")
Catch ex As Exception
Throw ex
End Try
Console.Read()
But When it execute the line
swEdges = swFixedFace.GetEdges()
I get this exception I dont know why !!
Please help me
SolidworksApi macros