Dim feature As feature
Dim boolstatus As Variant
Dim Part As Object
Dim longstatus As Long, longwarnings As Long
Sub Modif_art2()
Set swApp = CreateObject("SldWorks.Application")
Set Model = swApp.ActiveDoc
' Select the feature named "Extrude1"
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("Boss.-Extru.1@XXXXXD06-1@XXXXX_0000_00_D_111", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
' If the selection was successful, that is, "Extrude1" was
' selected and it is a "BODYFEATURE", then get that feature; otherwise,
' indicate failure
If boolstatus = True Then
Dim SelMgr As SelectionMgr
Set SelMgr = Model.SelectionManager
Set feature = SelMgr.GetSelectedObject6(1, 0)
Set swCustPropMgr = swCutlistItem.CustomPropertyManager("No_article")
Debug.Print "No_article"
Debug.Print "Number of custom properties = 28 " + CStr(swCustPropMgr.Count("6"))
Debug.Print "No_article", "", "200", "Texte"
'Names = swCustPropMgr.GetNames("2000")
End If
End Sub*
J'ai aussi essayer cette méthode et je suis bloquer sur la ligne :
Debug.Print "Number of custom properties = 28 " + CStr(swCustPropMgr.Count("6"))
avec une erreur " Objet requis "
Ref : http://help.solidworks.com/2012/English/api/sldworksapi/Get_Custom_Properties_for_Cut-list_Item_Example_VB.htm
afin de voir si j'arrivé a accéder au propriété de ma pièce .