Hello,
I before I export to dxf or step I want to know if the part is sheet-metal. (If sheet metal then export to dxf and step else only export step)
I found this code that gives met statistics and the names and type of the features but sheet-metal = type 22 and Cut-Extrude = type 22 an M4 Tapped Hole = type 22 flat pattern = type 22 and the sketch = type 9
I'm looking for something that tells me that sheet-metal is used in the part. The features names do NOT have sheet-metal in the name so I'm unable to test on that.
Does someone have any suggestion?
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System
Imports System.Diagnostics
Partial Class SolidWorksMacro
Public Sub main()
Dim swFeatStat As FeatureStatistics
Dim swFeatMgr As FeatureManager
Dim swModel As ModelDoc2
Dim featnames As Object
Dim feattypes As Object
Dim features As Object
Dim featureUpdateTimes As Object
Dim featureUpdatePercentTimes As Object
Dim iter As Integer
swModel = swApp.ActiveDoc
swFeatMgr = swModel.FeatureManager
swFeatStat = swFeatMgr.FeatureStatistics
swFeatStat.Refresh()
MsgBox("Model name: " & swFeatStat.PartName & vbNewLine & vbNewLine & " Number of features: " & swFeatStat.FeatureCount & vbNewLine & " Number of solid bodies: " & swFeatStat.SolidBodiesCount & vbNewLine & " Number of surface bodies: " & swFeatStat.SurfaceBodiesCount & vbNewLine & " Total rebuild time: " & swFeatStat.TotalRebuildTime)
featnames = swFeatStat.FeatureNames
feattypes = swFeatStat.FeatureTypes
features = swFeatStat.Features
featureUpdateTimes = swFeatStat.FeatureUpdateTimes
featureUpdatePercentTimes = swFeatStat.FeatureUpdatePercentageTimes
If Not featnames Is Nothing Then
For iter = 0 To UBound(featnames)
MsgBox(" Feature name: " & featnames(iter) & " - Feature type: " & feattypes(iter))
Next iter
End If
End Sub
'''
''' The SldWorks swApp variable is pre-assigned for you.
'''
Public swApp As SldWorks
End Class
SolidworksApi macros