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.
<p>Sub PatternData(swCPFeature As SldWorks.Feature)</p><p></p><p> Dim swCPData As SldWorks.CircularPatternFeatureData</p><p> Dim swAxis As SldWorks.Feature</p><p> Dim swCPAxis As SldWorks.RefAxis</p><p> Dim bolReturn As Boolean</p><p></p><p> Set swCPData = swCPFeature.GetDefinition</p><p> swCPData.AccessSelections swModel, Nothing</p><p> Set swAxis = swCPData.Axis <== This gets set to nothing</p><p><span style="font-size: 9pt; line-height: 12pt;"> Set swCPAxis = swAxis.GetSpecificFeature2</span></p><p> Debug.Print "Total instances: " & swCPData.TotalInstances</p><p> Debug.Print "Angle: " & Round(swCPData.Spacing * 180 / (4 * Atn(1)) / swCPData.TotalInstances)</p><p> swCPData.ReleaseSelectionAccess</p><p> </p><p>End Sub</p>
I need another pair of eyes to find the issue.
Thank you - Dave
SolidworksApi macros