Get Sense for Each Coedge in a Loop (VBA)
This example gets the coedges in a loop and their senses.
'--------------------------------------
' Preoconditions: Model is active.
'
' Postconditioins: None
'--------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim myEdge As SldWorks.CoEdge
Dim myLoop As SldWorks.Loop2
Dim myFace As SldWorks.Face2
Dim myEdges As Variant
Dim index As Integer
Dim count As Integer
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Stop
' Select a face on the model
Set myFace = swSelMgr.GetSelectedObject6(1,
-1)
' Get the first loop on the selected face
Set myLoop = myFace.GetFirstLoop
' Get the number of coedges in the loop
count = myLoop.GetCoEdgeCount
Debug.Print count
' Get the coedges in the loop
myEdges = myLoop.GetCoEdges
' For each coedge, get its sense
For index = LBound(myEdges) To UBound(myEdges)
Set myEdge = myEdges(index)
Debug.Print myEdge.GetSense
Next index
End Sub