Suite of numbered plates laser cut

I have to make a series of numbered plates cut with a laser I am looking for a solution to generate the DXF on solidworks automatically thank you in advance

Hello;

You should be able to perform your bulk exports with the " Solidworks Task Scheduler"

Otherwise I think there are already some macros lying around on the Forum...

For example, the macro of @js_1207

Transcript below:

Option Explicit

Private Const BIF_RETURNONLYFSDIRS As Long = &H1
Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2
Private Const BIF_RETURNFSANCESTORS As Long = &H8
Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000
Private Const BIF_BROWSEFORPRINTER As Long = &H2000
Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000
Private Const MAX_PATH As Long = 260

Function BrowseFolder(Optional Caption As String, Optional InitialFolder As String) As String

Dim SH As Shell32.Shell
Dim F As Shell32.Folder

Set SH = New Shell32.Shell
Set F = SH.BrowseforFolder(0&, Caption, BIF_RETURNONLYFSDIRS, InitialFolder)
If Not F Is Nothing Then
    If F = "Desktop" Then
        BrowseFolder = Environ("USERPROFILE") & "\Desktop"
    Else
        BrowseFolder = F.Items.Item.Path
    End If
End If

End Function

Sub main()
Dim swApp        As SldWorks.SldWorks
Dim swmodel      As SldWorks.ModelDoc
Dim sFileName    As String
Dim Path         As String
Dim nErrors      As Long
Dim nWarnings    As Long
Dim swPart       As SldWorks.PartDoc
Dim PartNoDes    As String
Dim stPath As String
Dim lgFichier As Long
Dim blretval As Boolean


    Set swApp = Application.SldWorks
  '  Set swExportPDFData = swApp.GetExportFileData(1)
  
    
    Path = BrowseFolder("Select a Path/Folder")
    If Path = "" Then
        MsgBox "Please select the path and try again"
        End
    Else
    Path = Path + "\"
    End If
         
    sFileName = Dir(Path & "*.sldprt")
    Do Until sFileName = ""
        Set swmodel = swApp.OpenDoc6(Path + sFileName, swDocPART, swOpenDocOptions_Silent, "", nErrors, nWarnings)
        Set swmodel = swApp.ActiveDoc
        Set swPart = swApp.ActiveDoc
           
                   If swmodel.GetPathName = "" Then
            MsgBox "Veuillez enregistrer votre document avant de lancer la macro", vbInformation
            End
        Else
            'on récupére l'emplacement du fichier
            stPath = swmodel.GetPathName

            'on récupére le nombre de caractére jusqu'au . de l'extension
            lgFichier = InStrRev(stPath, ".", -1, vbTextCompare) - 1
            'on récupére le chemin sans l'extention
            If lgFichier > 0 Then
                  stPath = Left(stPath, lgFichier)
            End If
        End If
        
        'si le document est une pièce
        If swmodel.GetType = swDocPART Then
           'on créer le déplié
            blretval = swmodel.ExportFlatPatternView(stPath & ".DXF", 1)
            'on créer le DXF
            blretval = swmodel.SaveAs3(stPath & ".DXF", 0, 0)
        End If
           
             swApp.QuitDoc swPart.GetPathName
        Set swPart = Nothing
        Set swmodel = Nothing
        sFileName = Dir
    Loop

MsgBox "All Done"
End Su

Kind regards

2 Likes

Here is what I found from the archives:
By following Lynk's method for example:

Then to export via task scheduler cf method @Maclane or via macro or batchconverter (one month trial version downloadable)
And this one a little more detailed:

Or without SW:

MyCADtools link for the Batchconverter trial utility:

… Additional Response @sbadenis :grin:
I'll take care of the *.dxf and you will take care of the numbering then...?

1 Like