From 894e3963ffac48e61f3c8b3d508989dc4c403255 Mon Sep 17 00:00:00 2001 From: Obliviatum Date: Tue, 20 Feb 2024 17:39:09 +0100 Subject: [PATCH] Solved return empty cut-list-item The chance is that there is another cut-list-item hiding in the background, which can still be accessed via the API. The following changes to the code ensure that it gets the correct cut-list-item. --- .../cut-lists/copy-custom-properties/Macro.vba | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/solidworks-api/document/cut-lists/copy-custom-properties/Macro.vba b/solidworks-api/document/cut-lists/copy-custom-properties/Macro.vba index a4127a1d..668157e4 100644 --- a/solidworks-api/document/cut-lists/copy-custom-properties/Macro.vba +++ b/solidworks-api/document/cut-lists/copy-custom-properties/Macro.vba @@ -58,8 +58,17 @@ Function GetCutListPropertyManager(model As SldWorks.ModelDoc2) As SldWorks.Cust While Not swFeat Is Nothing If swFeat.GetTypeName2() = "CutListFolder" Then - Set GetCutListPropertyManager = swFeat.CustomPropertyManager - Exit Function + + Dim BodyFolder As SldWorks.BodyFolder + Set BodyFolder = swFeat.GetSpecificFeature2 + + Dim BodyCount As Long + BodyCount = BodyFolder.GetBodyCount + + If BodyCount <> 0 Then + Set GetCutListPropertyManager = swFeat.CustomPropertyManager + Exit Function + End If End If Set swFeat = swFeat.GetNextFeature @@ -97,4 +106,4 @@ Sub CopyProperties(srcPrpMgr As SldWorks.CustomPropertyManager, targPrpMgr As Sl Err.Raise vbError, "", "No properties to copy" End If -End Sub \ No newline at end of file +End Sub