Inderdaad, ik zie ook niet in hoe ik een revisieregel in Integratie kan toevoegen.
Aan de macrokant heb ik dit dat het werk doet, maar moet worden aangepast aan je eigen eigenschappen. (Wat een naam voor de rev en voor de beschrijving.
Momenteel is er voor de beschrijving een invoervak dat de vraag plaatst, maar de mogelijkheid om een tekst in te voeren in hard vrij eenvoudig.
Dan hoef je alleen maar de macro in Integratie te starten en het doet het werk 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
Om dit soort verwerking uit te voeren, gebruik ik "Integratie" gekoppeld aan een kleine macro. -> u deze moet wijzigen met: De exacte locatie van uw annotaion tafel: voor de bestelling: Stel mytablerev in = currentsheet. InsertRevisionTable(True, 0, 0, 3, "W:\Modeles_solidworks\table_de_revision UW REVISIETABEL.sldrevtbt")
Optioneel de naam van de laag waarop u uw tabel wilt hebben: myRevisionTable.GetAnnotation.Layer = "Annotatie"
En vooral het trefwoord dat is ingesteld in je Solidworks-instellingen voor nieuwe revisies... (Systeem optie... Tekening... Aangepaste eigenschap die wordt gebruikt als revisie... Waarde = swModel.DeleteCustomInfo("Revisie") Waarde = swModel.AddCustomInfo3("", "Revisie", swCustomInfoText, Revis)
Hier is de macro in kwestie:
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
Vervolgens, na het instellen van "Intergration" met de "Teksten" informatie naar wens...., voeg de bewerking "Start een macro"... (Methode: Insert_table_revision1. Ajout_table_rev)