Bonjour,
je voudrai modifier la macro ci dessous pour utiliser un propriété de la pièce comme nom de fichier DXF. (au lieu d'ajouter l'indice)
Pouvez vous m'aider, je ne connais pas la programmation des macro et j'ai 500 fichiers à traiter
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc 'associe part au document en cours
If Part.GetType = swDocDRAWING Then 'verif type document
Set swModExt = Part.Extension
Set Prop = swModExt.CustomPropertyManager("")
Part.ForceRebuild3 True
Set swView = Part.GetFirstView
'la première vue étant la feuille, passage à la suivante
Set swView = swView.GetNextView
'récupération de la pièce
Set swModel = swView.ReferencedDocument
Set swModExt = swModel.Extension
'affectation de "Indice" à "Att"
Dim RevTable As Object
Set Prop = swModExt.CustomPropertyManager("")
Set RevTable = Part.GetCurrentSheet.RevisionTable
Set custpropmgr = Part.Extension.CustomPropertyManager("")
Att = "" 'initialise la variable Ind
Att = RevTable.Text(0, 0)
'Att = Part.GetCustomInfoValue("", "Révision") 'recupere l'indice du plan
'boolstatus = Prop.Get3("Indice", False, ValOut, Att)
If Att = " " Then Att = ""
If Att = "Indice" Then Att = ""
'récupération du chemin complet
swPathName = Part.GetPathName
If swPathName = "" Then
swApp.SendMsgToUser ("Le fichier de mise en plan n'est pas enregistré, veuillez le faire et recommencer")
Exit Sub
End If
nomchemin = Mid(swPathName, 1, Len(swPathName) - 7)
'enregistrement dxf
swPathName = nomchemin & Att + ".dxf" ' ajoute _ind et.dxf"
Set swModExt = Part.Extension
Part.ViewZoomtofit2
boolstatus = swModExt.SaveAs(swPathName, 0, 0, swExportPDFData, Errors, Warnings) 'sauvegarde en dxf
'enregistrement pdf
swPathName = nomchemin & Att + ".pdf" ' ajoute _ind et .pdf"
Set swModExt = Part.Extension
Part.ViewZoomtofit2
boolstatus = swModExt.SaveAs(swPathName, 0, 0, swExportPDFData, Errors, Warnings) 'sauvegarde en pdf
Else: swApp.SendMsgToUser ("Cette macro fonctionne uniquement avec une mise en plan")
End If
End Sub