AnsweredAssumed Answered

Macro to save as pdf, dwg, dxf and step from drawing.

Question asked by Samuell Poirier on Jul 15, 2020
Latest reply on Jul 16, 2020 by Samuell Poirier

Hello all,

 

I've been trying to make a one click for everything macro for a while and I can't seem to get anywhere.

 

Here is the set up:

 

Supposing I have an excel file with 3 columns.

 

1. Name of the drawing file in solidworks

2. Last solidworks revision number of that drawing

3. Last revision in our SAP software (ie. Magica)

 

From an opened drawing (*.slddrw) 

 

Step 1.

Verify if the current revision number found in the part number custom properties (eg. 04) is greater than the revision number in the excel file in column 2. 

Step 2.

-If it's equal or lower: Print an error code "Revision number has not been changed in solidworks" and stop. [User would then change the revision number in custom properties]

-If it's greater, continue.

Step 3. 

Verify if the current revision number found in the part number custom properties (eg. 05) matches with the revision number in the excel file in column 3.

Step 4

If it does match: Print an error code "Revision number has not been changed in Magica" and stop.  [User would then change the revision number in Magica]

Step 5 [If it's possible]

Increase the revision number in both columns by 1 [This could be done by hand afterwards]

Step 6.

Export the drawing as a PDF file adding the revision number at the end as "DRAWING-NUMBER"-Rxx.pdf

eg. -R05

Step 7

Export the drawing as a DWG file adding the revision number at the end as "DRAWING-NUMBER"-Rxx.dwg

eg. -R05

 

[This is where I can't seem to make anything work or combine anything]

 

Step 8

Export the part the drawing is referencing as a STEP file adding the revision number at the end as "DRAWING-NUMBER"-Rxx.step

eg. -R05

Step 9

If there is a flat pattern in the drawing, the flat pattern view of the drawing as a DXF file adding the revision number at the end as "DRAWING-NUMBER"-Rxx.dxf

eg. -R05

 

[I don't know if this step is possible or not but I'm pretty sure it's not]

 

Step 10

Merge all the files the macro just created into a zip file

 

Step 11

Print "Finished!"

 

I know this is probably a pretty big macro but I can't seem to make it work and it would save us a tremendous amount of time.

 

Thank you in advance.

Outcomes