API to get material and thickness

I have a multi-body model with different thickness and material. How can i get the material and thickness from the cut-list subfolder.

The following figure is the feature manager tree of my part.

SolidworksApi macros
Answers 2
AT
AT 2013-02-06 Best Answer

Try this macro which extacts these values for every cut-list item:

<p>Dim swApp As SldWorks.SldWorks</p><p>Dim swModel As SldWorks.ModelDoc2</p><p>Dim swFeat As SldWorks.Feature</p><p></p><p></p><p>Sub main()</p><p></p><p></p><p>    Set swApp = Application.SldWorks</p><p></p><p></p><p>    Set swModel = swApp.ActiveDoc</p><p>    </p><p>    Set swFeat = swModel.FirstFeature</p><p>    </p><p>    While Not swFeat Is Nothing</p><p>    </p><p>        Dim swSubFeat As SldWorks.Feature</p><p>        </p><p>        Set swSubFeat = swFeat.GetFirstSubFeature</p><p>        </p><p>        While Not swSubFeat Is Nothing</p><p>            If swSubFeat.GetTypeName2() = "CutListFolder" Then</p><p>                Dim swCustPrpMgr As SldWorks.CustomPropertyManager</p><p>                Set swCustPrpMgr = swSubFeat.CustomPropertyManager</p><p>                Dim val As String</p><p>                Dim resVal As String</p><p>                swCustPrpMgr.Get2 "Sheet Metal Thickness", val, resVal</p><p>                Debug.Print swSubFeat.Name</p><p>                Debug.Print " - Sheet Metal Thickness: " & resVal</p><p>                swCustPrpMgr.Get2 "Material", val, resVal</p><p>                Debug.Print " - Material: " & resVal</p><p>            End If</p><p></p><p></p><p>            Set swSubFeat = swSubFeat.GetNextSubFeature</p><p>        Wend</p><p>        </p><p>        Set swFeat = swFeat.GetNextFeature</p><p>        </p><p>    Wend</p><p>    </p><p>End Sub</p>

__________________________

Regards,

Artem Taturevych

Application Engineer at Intercad

http://intercad.com.au/

Tel: +61 2 9454 4444

SF
SF 2013-02-21

Hi Artem,

If i didn't assign material to a part, i cant get it's properties. In a multibody part if material is not assigned and having different thickness, how can i get individual body thickness.

In case of mirrored part how can i get its properties.

comment imagecomment image