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.
Is there a document that explains in detail how to use the Property Manager?
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
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?