AnsweredAssumed Answered

Traverse Faces in a Circular Pattern

Question asked by Dave Paul on Jun 3, 2015
Latest reply on Jun 3, 2015 by Keith Rice

I would like to add an axis to all the holes in a circular pattern.  I have just about everything except for access to the individual faces of the features in the pattern.  Here is the code that I have so far.  I'm just stubbing up.


Dim swApp As SldWorks.SldWorks
Dim swCirPat As SldWorks.CircularPatternFeatureData
Dim swModelDoc As SldWorks.ModelDoc2
Dim swPartDoc As SldWorks.PartDoc
Dim swFeat As SldWorks.Feature
Dim bolStatus As Boolean
Dim swInstance As Variant
Dim intCount As Integer
Dim intCountPatFace As Integer

Sub main()
    Set swApp = Application.SldWorks
    Set swModelDoc = swApp.ActiveDoc
    Set swPartDoc = swModelDoc
    Set swFeat = swPartDoc.FeatureByName("CirPattern6")
    Set swCirPat = swFeat.GetDefinition
    bolStatus = swCirPat.AccessSelections(swModelDoc, Nothing)
    intCount = swCirPat.TotalInstances
    For i = 0 To (intCount - 1)
      Debug.Print "  Processing instance... " & (i + 1)
      bolStatus = swModel.Extension.SelectByID2("", "FACE", -0.282507498267705, 0.138969899029291, 4.17544183963798E-02, False, 0, Nothing, 0)
      bolStatus = swModel.InsertAxis2(True)
End Sub


Thank you - Dave