AnsweredAssumed Answered

API/Macro, Multi pages drawing, tables problem.

Question asked by Mathieu Jette on Dec 6, 2016
Latest reply on Dec 7, 2016 by Mathieu Jette

Hi,

     We are using a macro for batch print and inputs of properties in the drawings as they are being printed.

When a drawing has multiple pages (1 for each configuration of the assembly/part), the macro scans the bom to identify the page to print (as far as how I understand it).

It works well untill there is another table (revision, or plain table) in the sheet... if so, then the macro crashes.

I need help to fix this issue.

 

Here is the Macro Section concerned. with the line where it crashes identified.

 

Set swFeatMgr = Sw_model.FeatureManager

Bon_Sheet = False

Sw_Sheets = Sw_Draft.GetSheetNames

N_Sheet = 1

If Sw_Draft.GetSheetCount = 1 Then GoTo Pass_Sheet

For J = 0 To UBound(Sw_Sheets)

    bRet = Sw_Draft.ActivateSheet(Sw_Sheets(J))

    Set Sw_Sheet = Nothing

    Set Sw_Sheet = Sw_Draft.Sheet(Sw_Sheets(J))

    Set Sw_View = Sw_model.GetFirstView

    Do While Not Sw_View Is Nothing

        Set SwAll_table = Sw_View.GetFirstTableAnnotation

        Do While Not SwAll_table Is Nothing

            Set Sw_Bom = Nothing

            Set Sw_Bom = SwAll_table

            Set Sw_Bom_Feature = Nothing

            Set Sw_Bom_Feature = Sw_Bom.BomFeature                                    'Crash happens here

            Names = Sw_Bom_Feature.GetConfigurations(True, Visible)

            If Names(0) = Config_Name Then

                Bon_Sheet = True

                Exit Do

            End If

            Set SwAll_table = SwAll_table.GetNext

        Loop

        If Bon_Sheet = True Then

            Exit Do

        End If

       

        bolUseParentStyle = Sw_View.GetUseParentDisplayMode()

        lngDisplayMode = Sw_View.GetDisplayMode2

        bolDispEdgesInShadedMode = Sw_View.GetDisplayEdgesInShadedMode

        bolResult = Sw_View.SetDisplayMode3(bolUseParentStyle, lngDisplayMode, False, bolDispEdgesInShadedMode)

       

        Set Sw_View = Sw_View.GetNextView

    Loop

    If Bon_Sheet = True Then

        Exit For

    End If

    N_Sheet = N_Sheet + 1

Next J

 

 

Any help will be appreciated.

Thanks.

Outcomes