Subscript a table of revisions in automatic

Hello

I have a file of 220 drawings on which there is a table of revisions

I would like to process all the plans at once to put a higher index and add a mention (e.g. UPDATE BACKGROUND PLAN)

Is this possible through tools like Integration?

Clarification: I don't have PDM.

Thank you! Patrik

How is your revision table made?

Is this an Index property that is evolving?

Property stored in the MEP or in the room?

If so, no need for integration if the tables are all existing.

With batchproperties you upgrade your property on the MEP lot.

Otherwise, Integration is able to insert a revision table on a plan batch, and evolve a property by creating a rule.

Depending on how you create your index table (without PDM) the solution is not necessarily the same.

this is the second case, and the revision table is already on the MEP (no need to integrate it)

In integration, we do have a type recognition: if it's a plan and there is a (revision) table

On the other hand, no action that could be associated, such as: adding a row to this table 

 

 

Indeed, I don't see how to add a revision line in Integration either.

On the macro side I have this which does the job, but to be modified according to your own properties. (What a name for the rev and for the description.

Currently for the description there is an input box that posts the question but possibility to put a text in hard quite simply.

Then you just have to launch the macro in Integration and it does the job in batch.

Code:

'This macro automates the adding of revision information to a drawing document

'Precondition: Any open solidworks drawing document

'Postcondition: A revision line added to the revision table and the revision custom _
                property of the document and all part/assembly files with the same _
                drawing number incremented by one.

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDrwDoc As SldWorks.DrawingDoc
Dim swRevTable As SldWorks.RevisionTableAnnotation
Dim swView As SldWorks.View
Dim swRefModel As SldWorks.ModelDoc2

Dim revTableTemp As String
Dim Rev As String
Dim revDesc As String
Dim drwNo As String

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

'Verify active document is a drawing
If swModel Is Nothing Then
    swApp.SendMsgToUser2 "Please open a .slddrw document and try again!", swMbWarning, swMbOk
    End
ElseIf swModel.GetType <> swDocDRAWING Then
    swApp.SendMsgToUser2 "This macro only works with .slddrw documents!", swMbWarning, swMbOk
    End
End If

Set swDrwDoc = swModel
Set swRevTable = swDrwDoc.GetCurrentSheet.RevisionTable
revTableTemp = swApp.GetUserPreferenceStringValue(swUserPreferenceStringValue_e.swFileLocationsRevisionTableTemplates)

'Set the revision description for the revision to be added
revDesc = InputBox("Enter revision description:", "Add Revision")
'verify the cancel button was not pressed
If revDesc = "" Then
    End
End If

'add revision table if one doesn't exist and set the revision string
If swRevTable Is Nothing Then
    Set swRevTable = swDrwDoc.GetCurrentSheet.InsertRevisionTable(True, 0, 0, swBOMConfigurationAnchor_BottomRight, revTableTemp & "\standard revision block.sldrevtbt")
    Rev = swModel.CustomInfo("Revision") + 1
ElseIf swRevTable.CurrentRevision = "" Then
    Rev = swModel.CustomInfo("Revision") + 1
Else
    'Rev = swRevTable.Text(0, 0) + 1
    'Rev = A
End If

'add revision & description to the revision table
swRevTable.AddRevision Rev
swRevTable.Text(0, 2) = revDesc

'if new revision is less 10, append 0 to beginning
If Rev < 10 Then Rev = "0" & Rev

'bump the revision of model if part/assembly no. is the same as the drawing no.
drwNo = Left(swModel.GetPathName, Len(swModel.GetPathName) - 7)
drwNo = Replace(drwNo, "C:\PDMWorks Local\", "")
Set swView = swModel.GetFirstView
Set swView = swView.GetNextView
Do
    'Debug.Print swView.Name
    Set swRefModel = swView.ReferencedDocument
    If InStr(1, swRefModel.GetPathName, drwNo) Then swRefModel.CustomInfo("Revision") = Rev
    If swRefModel.GetType = swDocASSEMBLY Then
        Dim swComps() As SldWorks.Component2
        Dim swComp As Variant
        Dim swComponent As SldWorks.ModelDoc2
        swComps = swRefModel.GetComponents(True)
        For Each swComp In swComps
            Set swComponent = swComp.GetModelDoc2
            If InStr(1, swComp.GetPathName, drwNo) Then swComponent.CustomInfo("Revision") = Rev
        Next
    End If
    Set swView = swView.GetNextView
Loop Until swView Is Nothing

'set Revision custom property of document and reduce the revision table to the last 3 revisions
swModel.CustomInfo("Revision") = Rev
If swRevTable.RowCount > 4 Then
    Rev = Rev - 3
    Do
        swRevTable.DeleteRevision Rev, True
        Rev = Rev - 1
    Loop Until swRevTable.RowCount = 4
End If
swModel.EditRebuild3

End Sub

 

1 Like

Hello;

To do this type of processing I use "Integration" associated with a small Macro.
-> you will have to modify it with:
The exact location of your annotaion table: for the order:
Set mytablerev = currentsheet. InsertRevisionTable(True, 0, 0, 3, "W:\Modeles_solidworks\table_de_revision\YOUR REVISION TABLE.sldrevtbt")


Optionally the Name of the layer on which you want your Table:
myRevisionTable.GetAnnotation.Layer = "Annotation"


And especially the keyword set in your Solidworks settings for new Revision ... (System Option... Drawing... custom property used as a revision...
Value = swModel.DeleteCustomInfo("Revision")
Value = swModel.AddCustomInfo3("", "Revision", swCustomInfoText, Revis)

Here is the macro in question:

Public swApp As SldWorks.SldWorks
Public swDoc As SldWorks.ModelDoc2
Public SwSheet As SldWorks.DrawingDoc
Public swview As SldWorks.View
Public SwTableRev As TableAnnotation
Public swAnn As SldWorks.Annotation

Public currentsheet As Object
Public mytablerev As Object


Dim LayerMgr As SldWorks.LayerMgr
Dim draw As SldWorks.ModelDoc2


Sub Ajout_table_rev()
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set SwSheet = swDoc

'insertion table
'attention changer le chemin pour la table de revision
' si true alors la table se met sur le point d'ancrage sinon sur coordonné 0,0

Set currentsheet = SwSheet.GetCurrentSheet
Set mytablerev = currentsheet.InsertRevisionTable(True, 0, 0, 3, _
 "W:\Modeles_solidworks\table_de_revision\VOTRE TABLE DE REVISION.sldrevtbt") 'A Modifier
Set myRevisionTable = currentsheet.RevisionTable
longstatus = myRevisionTable.AddRevision("")

'Deplace la table sur le calque "Annotation"
myRevisionTable.GetAnnotation.Layer = "Annotation" 'A Modifier si besoin

Dim Revis As String
Revis = myRevisionTable.CurrentRevision

'Ajoute la valeur de "revision" sur la table
Dim Valeur As String
Set swModel = swApp.ActiveDoc
Valeur = swModel.DeleteCustomInfo("Revision") 'A Modifier si besoin
Valeur = swModel.AddCustomInfo3("", "Revision", swCustomInfoText, Revis) 'A Modifier si besoin

'force la reconstruction
Dim bRet As String
bRet = swModel.Rebuild(swRebuildOptions_e.swForceRebuildAll)

End Sub


Then, after setting "Intergration" with the "Texts" information to your liking...., add the operation "Launch a macro"...
(Method: Insert_table_revision1. Ajout_table_rev)

Kind regards.

1 Like