This might be of some use
DocExport : Assists user in exporting selected SolidWorks model configurations or SolidWorks drawing sheets to different file types. This is useful when you need to separate many configurations into individual files of another file type for a vendor to use/reference.
Deepak, Thank you for the reply. This macro would be terific if it exported dxf files from the model. It does export STEP files and IGES files but not DXF files. I believe it would be easily appended to someone that was accustomed to writing macros, I on the other hand am not the macro wizzard. I am sure someone out there has taken this macro and modified it to convert to DXF files. If I knew how to contact Lenny I would as him if he could modify the macro for DXF. Thanks again, I am still in search.......
That would make you the man of the hour if you could get this macro to save dxf files. Thank you for your efforts. I believe this is my first post, sorry it was such a dificult one but this macro would save countless hours for us sheet metal designers.
I contacted Lenny, he suggested that I add a line that reads ("DXF vector", ".dxf") to the DocExport.ini file. This enabled the user to checkbox the dxf selection and the macro ran through and updated all of the configurations inside Solidworks, even stated that the conversions were completed except that the files were not in the directory. Seems it may be alittle more difficult that It seems. How is your attempt going?
Thanks for the updates. I'm still messing (as having little knowledge for the API) and trying to combine few macros to get the job done. Will update you once I have something useful.
I have been contacted by the originator of this macro, Lenny, and he stated that the macro was written for an earlier version of SolidWorks (2004) and it was calling an older API. He also stated that he has to re-program that portion of the macro with the new API call that first appeared in SolidWorks 2007. He is going to re-program this original macro so that it supports DXF files. I will keep you informed of his progress and we will eventually have this disscussion "Answered".
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim vConfNameArr As Variant
Dim sConfigName As String
Dim nStart As Single
Dim i As Long
Dim bShowConfig As Boolean
Dim bRebuild As Boolean
Dim bRet As Boolean
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
vConfNameArr = swModel.GetConfigurationNames
For i = 0 To UBound(vConfNameArr)
sConfigName = vConfNameArr(i)
bShowConfig = swModel.ShowConfiguration2(sConfigName)
bRebuild = swModel.ForceRebuild3(False)
Dim FilePath As String
Dim PathSize As Long
Dim PathNoExtension As String
Dim NewFilePath As String
FilePath = swModel.GetPathName
PathSize = Strings.Len(FilePath)
PathNoExtension = Strings.Left(FilePath, PathSize - 6)
NewFilePath = PathNoExtension + sConfigName & ".DXF"
'Export Flat Pattern
bRet = swModel.ExportFlatPatternView(NewFilePath, 1)
Deepak, You have saved countless hour for us sheet metal designers. This macro works. I did contact Lenny so maybe Lenny will incorparate this into his "DocExport" macro so that we have the option of selecting specific configurations (or deselecting specific configurations) before we process the DXF flat parts. Thank you so much Deepak, from all of us whom specialize in sheet metal design, "Way to go!"
Deepak, I just finished installing SolidWorks 2010. The commands changed between these two versions when saving a model to a DXF file. This macro no longer works for the newer 2010 version. Please help if you can, as stated earlier, I would not know where to begin.
Give me some time, need to install SW2010 yet.
Start a new macro in SW2010 and copy & paste the codes. I did it and it is working.
Once I copied the above code into a new macro, the macro runs just as it should but there are no files inside the directory.