By Adam Nagy
Though the help file suggests the opposite, AddAtCentroid does not seem to work with EdgeLoop. However the solution is very simple: create an EdgeCollection and fill it with the Edges of the EdgeLoop:
Sub AddWpToCenterOfEdgeloop() Dim oDoc As PartDocument Set oDoc = ThisApplication.ActiveDocument Dim oFace As Face Set oFace = ThisApplication.CommandManager.Pick( _ kPartFaceFilter, "Select a face") Dim oColl As EdgeCollection Set oColl = ThisApplication.TransientObjects.CreateEdgeCollection Dim oEdge As Edge For Each oEdge In oFace.EdgeLoops(1).Edges oColl.Add oEdge Next Dim oWP As WorkPoint Set oWP = oDoc.ComponentDefinition.WorkPoints.AddAtCentroid( _ oColl, False) oWP.name = "MyWorkpoint" End Sub