Modyfikowanie łącza zegara BOM

Cze wszystkim

Aby zaoszczędzić czas, regularnie wykonuję Pack&Go, kopie rysunkowe, kopie arkuszowe, kopie tabel BOM...

Jest jednak dla mnie jeden punkt blokujący: tabela nomenklatury i związany z nią bańka, która traci wszelki " automatyzm ".

Czy można wyświetlić i/lub zmodyfikować plik, na który wskazuje tabela zestawienia komponentów?

Dziękuję

Powinieneś być w stanie uzyskać go za pomocą tego makra:
https://help.solidworks.com/2020/english/api/sldworksapi/get_model_path_names_in_bom_table_example_vb.htm
Ze zmodyfikowaną kolejnością dla nomenklatury o nazwie Nomenklatura1:

Option Explicit

 Sub Main()

    Dim swApp       As SldWorks.SldWorks
    Dim swModel     As SldWorks.ModelDoc2
    Dim swDraw      As SldWorks.DrawingDoc
    Dim swFeat      As SldWorks.Feature
    Dim swBomFeat   As SldWorks.BomFeature
   

    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swDraw = swModel
    Set swFeat = swModel.FirstFeature
    Do While Not swFeat Is Nothing
        If (swFeat.GetTypeName = "BomFeat") Then
            Debug.Print "******************************"
            Debug.Print "Feature Name = " & swFeat.Name
            Set swBomFeat = swFeat.GetSpecificFeature2
            If (swFeat.Name = "Bill of Materials1") Or (swFeat.Name = "Nomenclature1") Then
                ProcessBomFeature swApp, swModel, swBomFeat
            End If
        End If
        Set swFeat = swFeat.GetNextFeature
    Loop
    Debug.Print "End"
End Sub
Sub ProcessBomFeature(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swBomFeat As SldWorks.BomFeature)
    GetPathNames swApp, swBomFeat
End Sub
   

Sub GetPathNames(swApp As SldWorks.SldWorks, ByVal swBomFeature As SldWorks.BomFeature)
    Dim vConfigurations               As Variant
    Dim strConfiguration              As String
    Dim vVisibility                   As Variant
    Dim lIdx                          As Long
    Dim lNumConfigurations            As Long
    Dim lNumRow                       As Long
    Dim lNumColumn                    As Long
    Dim lRow                          As Long
    Dim swBOMTableAnnotation          As SldWorks.BomTableAnnotation
    Dim swTableAnnotation             As SldWorks.TableAnnotation
    Dim swDocument                    As SldWorks.ModelDoc2
    Dim swAssembly                    As SldWorks.AssemblyDoc
    Dim strDocumentName               As String
    Dim lStartRow                     As Long
    Dim bGetVisible                   As Boolean
    Dim vModelPathNames               As Variant
    Dim strItemNumber                 As String
    Dim strPartNumber                 As String
    Dim vModelPathName                As Variant
    Dim strModelPathName              As String
   

    strDocumentName = swBomFeature.GetReferencedModelName
    Set swDocument = swApp.GetOpenDocumentByName(strDocumentName)
    Debug.Print "Referenced model = " & strDocumentName
    Set swAssembly = swDocument
   

    ' For now assume we have only 1 table annotation.
    Set swBOMTableAnnotation = swBomFeature.GetTableAnnotations(0)
    Set swTableAnnotation = swBOMTableAnnotation
    lNumRow = swTableAnnotation.RowCount
    lNumColumn = swTableAnnotation.ColumnCount
 

   lStartRow = 1
                   

    If (Not (swTableAnnotation.TitleVisible = False)) Then
        lStartRow = 2
    End If
                   

    bGetVisible = False
    Debug.Print "# configurations = " & swBomFeature.GetConfigurationCount(bGetVisible)
    vConfigurations = swBomFeature.GetConfigurations(bGetVisible, vVisibility)
   

    If (Not IsEmpty(vConfigurations)) Then
        lNumConfigurations = UBound(vConfigurations) - LBound(vConfigurations) + 1
        For lIdx = 0 To (lNumConfigurations - 1)
            strConfiguration = vConfigurations(lIdx)
            Debug.Print ""
            Debug.Print "Configuration: " & strConfiguration
           

            For lRow = lStartRow To (lNumRow - 1)
                Debug.Print "  row = " & (lRow - lStartRow + 1)
                vModelPathNames = swTableAnnotation.GetModelPathNames(lRow, strItemNumber, strPartNumber)
                       

                Debug.Print "    item number = " & strItemNumber
                Debug.Print "    part number = " & strPartNumber
                                    

                If (Not IsEmpty(vModelPathNames)) Then
                    Debug.Print "    # models contributing to row = " & swTableAnnotation.GetModelPathNamesCount(lRow)
                    For Each vModelPathName In vModelPathNames
                        strModelPathName = vModelPathName
                        Debug.Print "       " & strModelPathName
                    Next vModelPathName
                Else
                    Debug.Print "    # models contributing to row = 0"
                    Debug.Assert (False)
                End If
            Next lRow
        Next lIdx
    End If
End Sub

2 polubienia

Dziękuję, ale na razie świat makro to dla mnie inna planeta!
Dziwi mnie, że edycja linków nie jest prostsza

Najprostszym sposobem bez makra jest usunięcie go i ponowne wstawienie.
Bo nie ma widoczności na widoku, na który wskazuje nomenklatura i nie ma śladu (linku) do mojej wiedzy.

1 polubienie

Niestety, to jest moja metoda.
Szkoda, że to strata czasu

Rzadko korzystam z Pack and Go.
Ze swojej strony kopiuję i wklejam części i rysunki, a następnie zmieniam nazwę za pomocą narzędzia SOLIDWORKS, które oferuje zmianę nazwy, przeniesienie itp.
Następnie przed otwarciem MEP ponownie kalibruję referencje i to wszystko, nomenklatury podążają za każdym razem.