API: Feature Mod date
API: Feature Mod date
(OP)
Has anyone used this successfully? (Feature:DateModified) ...I was hoping to use this to tell if/when parts files have been changed, but it seems to be pretty literal: it only shows a change in a mod date if the actual FEATURE (and not an underlying sketch or dimension) have been modified, like if you change the extrude DEPTH in the extrude FEATURE, but not if you change the shape in the sketch used BY the extrude Feature.
Is this is as intended? Is there a workaround? Where am I going, and what am I doing in this handbasket?
Is this is as intended? Is there a workaround? Where am I going, and what am I doing in this handbasket?






RE: API: Feature Mod date
RE: API: Feature Mod date
Regards,
Scott Baugh, CSWP

3DVision Technologies
http://www.3dvisiontech.com
http://www.scottjbaugh.com
FAQ731-376
When in doubt, always check the help
RE: API: Feature Mod date
By the way 'Tick' DateModified is avail as of sw03, sp0.
RE: API: Feature Mod date
First, modify a feature 'manually', save, and re-run the sub. The feature mod date *should* update.
Secondly, try changing dims from a design table; save, and re-run the sub. I was getting only the 'design table' feature as being updated.
Thirdly, make some dims in a sketch visible from outside the sketch; and modify/rebuild by double clicking the sketch dimension, save, rerun the sub. I was getting a nogo here, as well
' ----- cut here ----------------
Sub main()
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Feature As SldWorks.Feature
Dim subFeat As SldWorks.Feature
Dim Config As SldWorks.configuration
Const swDocPART = 1 ' Used to be TYPE_PART
Set swApp = Application.SldWorks
If swApp Is Nothing Then
MsgBox "Please start Solidworks before running this macro"
Exit Sub
End If
Set Part = swApp.ActiveDoc
If Part Is Nothing Then
MsgBox "Please have a part loaded"
Exit Sub
End If
Set Config = Part.GetActiveConfiguration
ConfigName$ = Config.Name
DebugPrint "Feature History for:" & ConfigName$
Set Feature = Part.FirstFeature 'Get the 1st feature in part
While Not Feature Is Nothing ' While we have a valid feature
featureName = Feature.Name ' Get the name of the feature
Creator$ = Feature.CreatedBy
CreateDate$ = Feature.DateCreated
Moddate$ = Feature.DateModified
Debug.Print vbCrLf & featureName & " Created By: " & Creator$ & " on " & CreateDate$
Debug.Print Chr$(9) & "Modified on " & Moddate$
SubFeatMsg$ = Chr$(9) & featureName & " SubFeatures:"
Set subFeat = Feature.GetFirstSubFeature
If Not (subFeat Is Nothing) Then Debug.Print SubFeatMsg$
While Not subFeat Is Nothing ' While we have a valid Sub-feature
' Get the name of the Sub-feature
subFeatureName$ = subFeat.Name
Creator$ = subFeat.CreatedBy
CreateDate$ = subFeat.DateCreated
Moddate$ = subFeat.DateModified
Debug.Print Chr$(9) & Chr$(9) & subFeatureName$ & " Created By: " & Creator$ & " on " & CreateDate$
Debug.Print Chr$(9) & Chr$(9) & "Modified on " & Moddate$
Set subFeat = subFeat.GetNextSubFeature
Wend ' Continue until the last Sub-feature is done
Set Feature = Feature.GetNextFeature()
Wend ' Continue until the last feature is done
End Sub