SolidWorks Adding Block API

Hello

When I add a block containing surface states or geometric tolerance, if I add it with the API the block says "Link broken", while if I add it manually it works.

This is particularly blocking.

Do you have this problem too or do you know how to fix it?

 

Example macro for you to test:

 

Dim swApp As SldWorks.SldWorks

Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()
    Set swApp = Application.SldWorks
    Set Part = swApp.ActiveDoc
   
    Dim myBlockDefinition As Object
    Set myBlockDefinition = Part.SketchManager.MakeSketchBlockFromFile(Nothing, "CHEMIN_VERS_LE_BLOCK", False, 1, 0)
End Sub

 

In attached file a block to test.

In pictures:


 

Thank you.


bloc_tolerance_trous_fil.sldblk

Well, since there aren't many answers, I'm going to reveal mine.

It's a bit of a DIY solution but still effective.

 

Instead of adding surface finishes and standard geometric tolerances, I redrew them by hand. In this way, no more broken ties. And if the work is done in a clean way, the difference is not visible!