×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API: Feature Mod date

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?

RE: API: Feature Mod date

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.

I may make you feel, but I can't make you think.

RE: API: Feature Mod date

(OP)
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.

RE: API: Feature Mod date

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources