Retrieve the Weld Length Property

Hello
In one assembly, I used the " weld seam" function.
I want to retrieve the value of the " total weld length" property in my custom properties.
But I don't know how to properly call the " LENGTH " property that is supposed to bring this value up.
Capture d’écran 2024-07-18 122628

Is there a document that explains in detail how to use the Property Manager?

Thank you in advance for your feedback!

Hello tdubedout,
Welcome to the forum, here is what I can bring you, hoping to have helped a little, Lol.


Good luck.
@+.
AR.

5 Likes

Hello, thank you for this feedback but I would like to get this info without going through a plan.
I'll continue my research!

Hello

Normally, you can also display BOMs in assemblies without going through drawing. It will be displayed in the 3D see photo in PC

1 Like

Hello tdubedout,
You can try this macro:

Option Explicit
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swWeldFolder As SldWorks.CosmeticWeldBeadFolder
    Dim swFeat As SldWorks.Feature
    Dim swSubFeat As SldWorks.Feature
    Dim Msg As String
    Msg = ""
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    If swModel Is Nothing Then MsgBox "Ouvrir un assemblage": Exit Sub
    If swModel.GetType <> swDocumentTypes_e.swDocASSEMBLY Then MsgBox "Ouvrir un assemblage": Exit Sub
    Set swFeat = swModel.FirstFeature
    While Not swFeat Is Nothing
        If swFeat.GetTypeName2 = "CosmeticWeldCutList" Then
            Set swSubFeat = swFeat.GetFirstSubFeature
            While Not swSubFeat Is Nothing
                Set swWeldFolder = swSubFeat.GetSpecificFeature2
                Msg = Msg & swWeldFolder.TotalNumber & " cordon de longueur totale: " & Round(swWeldFolder.TotalLength) & "mm" & vbCrLf
                Set swSubFeat = swSubFeat.GetNextSubFeature
            Wend
        End If
        Set swFeat = swFeat.GetNextFeature
    Wend
    MsgBox Msg
End Sub
3 Likes

Hello Jerome,
Thank you for this macro, it's great.
I modified a few lines so that it adds up the lengths of the different weld sizes.
Now I need to associate this value with a custom property of the SolidWorks model.
Is there a lexicon that contains the different " objects " that can be called on VBA in SolidWorks, the " functions " associated with them and also the different types of variables?

For the different objects, there is this list, but a Google search is faster.
To read a custom property use Get4
To write a custom property use Add3

3 Likes