Hi,
The problem is that my macro searches for fist feature called "Cut-list-item1", but sometimes if i open a older part the cut list is called "Cut-list-item2" or even "Cut-list-item6".
i tried to filter the name so if it contains "Cut-list-Item'' it will grab that one, but i can figure it out.
Thanks in advance,
Pieter Tessel.
Solidworks 2013 Cut list macro:
<p>Sub main()</p><p> Dim swApp As SldWorks.SldWorks</p><p> Dim swModel As SldWorks.ModelDoc2</p><p> Dim swFeat As SldWorks.Feature</p><p> Dim swCustPropMgr As SldWorks.CustomPropertyManager</p><p> </p><p> Dim retval As String</p><p> </p><p> Set swApp = Application.SldWorks</p><p> Set swModel = swApp.ActiveDoc</p><p> Set swFeat = swModel.FirstFeature</p><p> </p><p> retval = swModel.AddCustomInfo3("", "Stocksize", swCustomInfoText, "")</p><p> </p><p> Dim strValue As String</p><p> </p><p> Set swApp = Application.SldWorks</p><p> Set swModel = swApp.ActiveDoc</p><p> Set swFeat = swModel.FirstFeature</p><p> </p><p> Do While Not swFeat Is Nothing</p><p> If swFeat.Name = "Cut-List-Item1" Then</p><p> Set swCustPropMgr = swFeat.CustomPropertyManager</p><p> swCustPropMgr.Get4 "Description", False, Empty, strValue</p><p></p><p> Set swCustPropMgr = swModel.Extension.CustomPropertyManager(Empty)</p><p> swCustPropMgr.Set "Stocksize", strValue</p><p></p><p> Exit Do</p><p> End If</p><p> Set swFeat = swFeat.GetNextFeature</p><p> Loop</p><p>End Sub</p><p></p>SolidworksApi macros