Files
Autosize all reference planes in active part
Code
'Auto-sizes all reference planes in a part.
'Preconditions: part is open, planes should be visible in order to see before _
and after change
'Results: reference planes are auto-sized
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeat = swModel.FirstFeature
While Not swFeat Is Nothing
If swFeat.GetTypeName = "RefPlane" Then
swFeat.Select2 False, Empty
swApp.RunCommand swCommands_Auto_Size, Empty
End If
Set swFeat = swFeat.GetNextFeature
Wend
End Sub
'Notes:
'-Also tried to resize with IRefPlaneFeatureData::AutoSize but it does not seem to work.
'-Model view might not update immediately.