Ad

Monday, November 16, 2009

Get Modified By and Modified Date for Label Styles

If you wanted to see who modified a label style and when you could go through and select each label style group in Toolspace, Settings and see, but this could take a while. By using the Civil 3D API we can quickly go through and see what the Modified By and Modified Date was for each label style. The code below looks at some alignment and profile label styles. Doing the other types of labels would be similar.

Sub CheckStyles()

'always get the objects again since MDI is supported
If (GetBaseCivilObjects = False) Then
Exit Sub
End If

Dim oStyle As AeccLabelStyle

For Each oStyle In g_oRoadwayDocument.AlignmentLabelStyles.CurveLabelStyles
MsgBox "Alignment Curve Label Style: " & oStyle.Name & vbCrLf & _
"Modified By: " & oStyle.ModifiedBy & vbCrLf & _
"Date Modified: " & oStyle.DateModified
Next

For Each oStyle In g_oRoadwayDocument.AlignmentLabelStyles.MajorStationLabelStyles
MsgBox "Alignment Major Station Label Style: " & oStyle.Name & vbCrLf & _
"Modified By: " & oStyle.ModifiedBy & vbCrLf & _
"Date Modified: " & oStyle.DateModified
Next

For Each oStyle In g_oRoadwayDocument.ProfileLabelStyles
MsgBox "Profile Label Style: " & oStyle.Name & vbCrLf & _
"Modified By: " & oStyle.ModifiedBy & vbCrLf & _
"Date Modified: " & oStyle.DateModified
Next


End Sub



This code just goes through and shows you the information, you could also have If … Then statements to further reduce the label styles that will be shown. You could also add some code that would batch process numerous drawings at one time. Instead of a MsgBox the results could be sent to an Excel spreadsheet or a text document.

No comments:

LinkWithin

Blog Widget by LinkWithin

Ad