Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API: Feature Mod date

Status
Not open for further replies.

rocheey

Industrial
Jan 21, 2001
230
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?
 
Replies continue below

Recommended for you

I got nothin'. I'm not finding anything in the API documentation. I will be watching, because I think it would be interesting to know if it's possible to see how a feature was changed after the fact.

[bat]I may make you feel, but I can't make you think.[bat]
 
well, if one wants to delve into the depths of the structured storage (past the 'root' that the MS supplied .tlb lets you go) there's even lists of when features were *deleted*.

By the way 'Tick' DateModified is avail as of sw03, sp0.
 
for those of you who are interested, here is a sample sub that traverses features/subfeatures and outputs the creation/modification info to the debug window.

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor