1 Reply Latest reply on Jul 2, 2015 4:33 PM by Dave Paul

    Circular pattern axis data within a drawing

    Dave Paul

      I am trying to set a pointer to the RefAxis object for the CirPattern8 feature within a drawing file

       

      1. drawing file open

      2. In the Feature tree, under the Drawing View1, "CirPattern8" is selected

      3. Check that the feature is a "CirPattern" (swFeature.GetTypeName2 = "CirPattern")

      4. Pass the feature object to the PatternData subroutine

       

      Trying to figure out why on line 10, "swAxis" object sets to Nothing, so the "GetRefAxisParams" method cannot be used.

       

      Sub PatternData(swCPFeature As SldWorks.Feature)
      
        Dim swCPData As SldWorks.CircularPatternFeatureData
        Dim swAxis As SldWorks.Feature
        Dim swCPAxis As SldWorks.RefAxis
        Dim bolReturn As Boolean
      
        Set swCPData = swCPFeature.GetDefinition
        swCPData.AccessSelections swModel, Nothing
        Set swAxis = swCPData.Axis  <==  This gets set to nothing
        Set swCPAxis = swAxis.GetSpecificFeature2
        Debug.Print "Total instances: " & swCPData.TotalInstances
        Debug.Print "Angle: " & Round(swCPData.Spacing * 180 / (4 * Atn(1)) / swCPData.TotalInstances)
        swCPData.ReleaseSelectionAccess
        
      End Sub
      

       

      I need another pair of eyes to find the issue.

       

      Thank you - Dave