Automatic bubble loss

Hello @ all,

I have a plan of a configuration
And a macro that changes the configs of the views and BOM table to export a PDF plan for each configuration.

Unfortunately each config has more or less parts and the automatic bubbles disappear and do not reappear.

Do you have a lead to help me please

Thank you in advance

Hello

Can you provide the macro?

Cdlt

Here's my macro,
I'm not a pro in this field, it's my second. And the basis of the macro comes from this forum.
I try to make a macro that erases the bubbles to rest them but I block.

Kind regards


macro_pdf_enregistrer_sous-2.swp

Hello Yannik, any idea?

Hello

You can use the AutoBalloon5 feature 

Note: before you start coding, check that it works manually with the Auto_Balloons function 

Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim vNotes As Variant
Dim autoballoonParams As SldWorks.AutoBalloonOptions
Dim boolstatus As Boolean
Option Explicit
Sub main()
    Set swApp = Application.SldWorks
    Set Part = swApp.ActiveDoc
    boolstatus = Part.ActivateView("Drawing View1")
    boolstatus = Part.Extension.SelectByID2("Drawing View1", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
    Set autoballoonParams = Part.CreateAutoBalloonOptions()
    autoballoonParams.Layout = swBalloonLayoutType_e.swDetailingBalloonLayout_Top
    autoballoonParams.ReverseDirection = False
    autoballoonParams.IgnoreMultiple = True
    autoballoonParams.InsertMagneticLine = True
    autoballoonParams.LeaderAttachmentToFaces = True
    autoballoonParams.Style = swBS_Circular
    autoballoonParams.Size = swBF_5Chars
    autoballoonParams.UpperTextContent = swBalloonTextItemNumber
    autoballoonParams.Layername = "-None-"
    autoballoonParams.ItemNumberStart = 1
    autoballoonParams.ItemNumberIncrement = 1
    autoballoonParams.ItemOrder = swBalloonItemNumbers_DoNotChangeItemNumbers
    autoballoonParams.EditBalloons = True
    autoballoonParams.EditBalloonOption = swEditBalloonOption_Resequence
    vNotes = Part.AutoBalloon5(autoballoonParams)
End Sub

 

1 Like

Thank you JeromeP,

I wanted to do this, but I have to start by erasing the bubbles in place, because I have a loop that makes all the configurations.

and for that I was going to use "Part.Extension.SketchBoxSelect" but I'm new to macro in SW and I block quickly.

Kind regards

To erase all balloons from a sheet:

Option Explicit
Sub Main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swDraw As SldWorks.DrawingDoc
    Dim swView As SldWorks.View
    Dim swNote As SldWorks.Note
    Dim swAnn As SldWorks.Annotation
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    If swModel.GetType <> swDocumentTypes_e.swDocDRAWING Then
        MsgBox "Ouvrir un dessin", vbOKOnly + vbInformation
        Exit Sub
    End If
    Set swDraw = swModel
    Set swView = swDraw.GetFirstView
    swModel.ClearSelection2 True
    While Not swView Is Nothing
        Set swNote = swView.GetFirstNote
        While Not swNote Is Nothing
            If swNote.IsBomBalloon Then
                Set swAnn = swNote.GetAnnotation
                swAnn.Select3 True, Nothing
            End If
            Set swNote = swNote.GetNext
        Wend
        Set swView = swView.GetNextView
    Wend
    swModel.EditDelete
End Sub