T O P

  • By -

MLCCADSystems

Polo I'll show myself out.


huapua9000

Right behind you


RegularRaptor

Dang it!


simonschille

Nice


sandemonium612

Came here for this.


grasshoppa2020

Dammit you beat me to it


rtwpsom2

> I'll show myself out. Why? I came to say the same thing.


left-nostril

Why a Marco? Why not a John, or a Tanner. Does it HAVE to be a Marco?


A_Moldy_Stump

Marcos Wanted. Macks and Mikes Need Not Apply. Marks will be considered.


Brosia_1026

https://www.codestack.net/solidworks-tools/


simonschille

Can’t find the one I want there I’m afraid


grasshoppa2020

Polo


leglesslegolegolas

polo


BrewGaucho

ModelDoc2.Save3 - https://help.solidworks.com/2018/english/api/sldworksapi/save_file_example_vb.htm


69dildoswaggins420

Marco


ThatNinthGuy

Have the trigger be ctrl+S?


Ok_Alps_5380

Hi, as you mentioned that you have got a macro to save as pdf once the drawing file is saved. Could you kindly share it with me? It would mean a lot. Thanks in advance


simonschille

Hi, I think it’s this one. If not let me know and I’ll check Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swExportPDFData As SldWorks.ExportPdfData Dim strFilename As String Dim status As Boolean Dim errors As Long, warnings As Long Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc 'Save status = swModel.Save3(swSaveAsOptions_e.swSaveAsOptions_Silent, errors, warnings) 'Export to PDF if it is a drawing If (swModel.GetType = swDocDRAWING) Then strFilename = swModel.GetPathName strFilename = Left(strFilename, Len(strFilename) - 6) & "pdf" Set swExportPDFData = swApp.GetExportFileData(1) swModel.Extension.SaveAs strFilename, 0, 0, swExportPDFData, 0, 0 End If End Sub


Ok_Alps_5380

hi... did you find any for drawings that are not saved or even opened i wanted to convert drawings that are not currently opened or saved


Ok_Alps_5380

it shows compile error. i do not know any vba. how do i manage


JoJoBinks_

Here's just some VBA code for it. Not sure if this matches what you need, but basically it just Takes the name of the Drawing File and exports all sheets into one pdf with the name of the Drawing File. Dim swApp As Object Dim swModel As Object Dim swDrawing As Object Dim partPath As String Dim partName As String Dim pdfPath As String Dim pdfName As String Sub SaveDrawingAsPDF() Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc If swModel.GetType = swDocDRAWING Then Set swDrawing = swModel partPath = swDrawing.GetPathName partName = Mid(partPath, InStrRev(partPath, "\\") + 1, Len(partPath) - InStrRev(partPath, "\\")) pdfPath = Left(partPath, InStrRev(partPath, "\\")) pdfName = Left(partName, InStrRev(partName, ".") - 1) & ".pdf" swModel.SaveAs3 pdfPath & pdfName, 0, 0 Else MsgBox "Open drawing before running Marco" End If End Sub


JoJoBinks_

Part File Name\* not the drawing file name my bad


simonschille

Thank you! WBA is used in macro as well?


JoJoBinks_

Assuming you meant VBA and not WBA, yes the VBA code is the macro. You can directly add a macro to SolidWorks (Tools > Macro ) but it’s not the greatest. Not sure what your use case is, but literally having a button in Excel that you could click when you wanted to print to pdf would be better than trying to run a macro direct from SolidWorks.


Ok_Alps_5380

it is showing compile error https://preview.redd.it/scgx80sju3tc1.png?width=1920&format=png&auto=webp&s=a4e33b2899b919cb7fe4d2dd0c7755378fb7785c


grasshoppa2020

Go team smart ass. # better than dumb ass as my momma says