Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Public Enum swSkSegments_e
swSketchLINE = 0
swSketchARC = 1
swSketchELLIPSE = 2
swSketchSPLINE = 3
swSketchTEXT = 4
swSketchPARABOLA = 5
End Enum
Dim Total As Integer
Sub main()
Dim sSkSegmentsName(5) As String
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFeat As SldWorks.feature
Dim swSketch As SldWorks.sketch
Dim vSkSegArr As Variant
Dim vSkSeg As Variant
Dim swSkSeg As SldWorks.SketchSegment
Dim swSkLine As SldWorks.SketchLine
Dim swSkArc As SldWorks.SketchArc
Dim swSkEllipse As SldWorks.SketchEllipse
Dim swSkSpline As SldWorks.SketchSpline
Dim swSkText As SldWorks.SketchText
Dim swSkParabola As SldWorks.SketchParabola
Dim vID As Variant
Dim i As Long
Dim bRet As Boolean
Total = 0
On Error GoTo huboalgo
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swFeat = swSelMgr.GetSelectedObject4(1)
Set swSketch = swFeat.GetSpecificFeature
vSkSegArr = swSketch.GetSketchSegments
For Each vSkSeg In vSkSegArr
Set swSkSeg = vSkSeg
Total = Total + 1
Next vSkSeg
MsgBox "Total of segments: " & Total, vbInformation, "SEGMENTS COUNT"
GoTo THEEND
huboalgo:
MsgBox "Please select an sketch", vbCritical, "MACRO ERROR"
THEEND:
End Sub