Cutlist item length of imported part can not be resolved

Hello,

I have a weldment part, which contains multiple bodies. Due to the policy of our company, every assembly must be an assembly in a drawing, not a part of multiple bodies as it is a default policy of Solidworks software. To achieve this, I create a weldment structure as a parent part file, and then create a separate child part files for each structural element. I import a full parent part (Insert>Part) into a child and leave only one body in each of child parts by using "Delete bodies" feature. When I am done with all the child parts, I bring all these parts into an assembly ...

I described this because I would welcome any suggestion, how to get every structural member as a separate part in "Parts only" BOM (again, this is a requirement in our company, there are further actions being processed from these BOMs). I have wrote an enhancement request so that SW would implement a feature to "Show detailed cut list" in "Parts only" BOM with a possibility to dissolve it. But even if they will I guess it will take a while, so I have to get another solution until then ..

Anyhow, after bringing all the child parts to assembly, every child part must have a file's custom property "Length" with a value of the length of an imported tube. I am composing a simple macro which would do that automatically. For this exact task i know that I will always have one solid body, therefore one element in a "Solid bodies" folder. So I am finding the first one, and reading the "Length" of an cut list item. I am using "Get5" method of CustomPropertyManager. The problem I am facing is that the "Resolved value" it returns is still value of calculation, not a result. It returns the same values for ValOut and ResolvedValOut, which is:

LENGTH@@@TUBE, SQUARE 40 X 40 X 4<1>@Part1.SLDPRT

The code is working fine with a part that has native features, with native values (not "from parent" values).

Solidworks shows a good value if I manually go on the item in the feature tree and right click for properties.

Question: How do I get the resolved value of a cutlist item?

This is my macro code is bellow.

I also attach the .swb file of this macro code,

the parent part with few structural members,

the child part with imported parent and deleted bodies,

and a separate file with structural member (macro works good with this one)

​

<p>Option Explicit</p><p></p><p>Dim swApp As SldWorks.SldWorks</p><p>Dim swModel As SldWorks.ModelDoc2</p><p>Dim SelMgr As SldWorks.SelectionMgr</p><p>Dim cutFolder As SldWorks.BodyFolder</p><p>Dim boolFound As Boolean</p><p></p><p>Dim swFeature As SldWorks.Feature</p><p>Dim swSubFeature As SldWorks.Feature</p><p>Dim swModelDocExt As SldWorks.ModelDocExtension</p><p>Dim swCutListFolder As Feature</p><p>Dim swCustPropCL As CustomPropertyManager</p><p>Dim swCustPropFile As CustomPropertyManager</p><p></p><p></p><p></p><p>Sub main()</p><p>    Set swApp = Application.SldWorks</p><p>    Set swModel = swApp.ActiveDoc</p><p></p><p>    If Not swModel.GetType = swDocPART Then</p><p>        swApp.SendMsgToUser "File type: non Part. Exiting"</p><p>        Exit Sub</p><p>    End If</p><p>    </p><p>    Set swFeature = swModel.FirstFeature</p><p>    boolFound = False</p><p></p><p>    </p><p>    Do While (Not swFeature Is Nothing) And (boolFound = False)</p><p>        Debug.Print swFeature.GetTypeName</p><p>        Set swSubFeature = swFeature.GetFirstSubFeature</p><p>        Do While (Not swSubFeature Is Nothing) And (boolFound = False)</p><p>            If swSubFeature.GetTypeName = "CutListFolder" Then</p><p>                Set swCustPropCL = swSubFeature.CustomPropertyManager</p><p>                </p><p>                Dim strValue As String</p><p>                Dim strResolvedValOut As String</p><p>                Dim blnWasResolved As Boolean</p><p>                </p><p>                Dim lRetVal As Long</p><p></p><p>        </p><p>                lRetVal = swCustPropCL.Get5("LENGTH", False, strValue, strResolvedValOut, blnWasResolved)</p><p>                Debug.Print "Length = " & strValue</p><p>                Debug.Print "Resolved length = " & strResolvedValOut</p><p>               </p><p>                Set swModelDocExt = swModel.Extension</p><p>                Set swCustPropFile = swModelDocExt.CustomPropertyManager("")</p><p>            </p><p>                'next two lines are for the future</p><p>                swCustPropFile.Add2 "AssignedLength", swCustomInfoText, "-"</p><p>                swCustPropFile.Set "AssignedLenth", "-"</p><p>            </p><p>                boolFound = True</p><p>            End If</p><p>            </p><p>            Set swSubFeature = swSubFeature.GetNextSubFeature</p><p>        Loop</p><p>        Debug.Print " "</p><p>        </p><p>    Set swFeature = swFeature.GetNextFeature</p><p>    Loop</p><p>    </p><p>End Sub</p>
SolidworksApi macros