I have a macro that uploads files from my computer to our FTP site using the pack and go method. I want only the drawing and the part on the FTP site. It works fine when I don't use the macro (I.E. launch the pack and go module from the solidworks interface), it only grabs the drawing and the part. But when I use the macro it grabs the drawing, part, and any referenced documents. I tried setting IncludeDrawings = False in PackAndGo, but it doesn't do anything. Below is my function that takes in an extension (I am sending it "slddrw") and will pack and go the model. The variable "outputDirectoryPath" is a global variable that I set before I launch the function. The variable "filesUploaded" is also a global variable that I use for user output later in the code. The variable "swModelDoc" is a global variable that is the active drawing.
Function packAndGoModel(extension As String)
Dim fileName As String
Dim boolSuccess As Boolean
Dim swPackAndGo As SldWorks.PackAndGo
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim packAndGoFiles As Variant
Dim packAndGoFile As String
Dim statuses As Variant
On Error GoTo Err:
Set swModelDocExt = swModelDoc.extension
Set swPackAndGo = swModelDocExt.GetPackAndGo()
swPackAndGo.IncludeDrawings = False
swPackAndGo.IncludeSimulationResults = False
swPackAndGo.FlattenToSingleFolder = True
swPackAndGo.IncludeToolboxComponents = False
statuses = swPackAndGo.SetSaveToName(True, outputDirectoryPath)
boolSuccess = swPackAndGo.GetDocumentNames(packAndGoFiles)
statuses = swModelDocExt.SavePackAndGo(swPackAndGo)
For i = 0 To UBound(packAndGoFiles)
packAndGoFile = packAndGoFiles(i)
fileName = getFileName(packAndGoFile)
filesUploaded = filesUploaded & vbNewLine & fileName
Next i
boolSuccess = True
GoTo Cont
Err:
boolSuccess = False
Cont:
packAndGoModel = boolSuccess
End Function
I am running Windows 7 x64 with solidworks 2015 professional x64 sp1.1. Also I am running the macro from a drawing, and the part that is referenced in the drawing views has other parts inserted in it that are used in other places, and when use pack and go from the macro it grabs everything.
Is there something I'm doing wrong in my function that IncludeDrawings doesn't work? It seems that no matter what I set it to it will always include drawings. Is there a possible work around? All I want to do is copy the drawing and part to another directory and have the drawing views reference that copied part in the other directory.
SolidworksApi macros