Png/Pdf Export

Hello

To put you in context, we are in the process of installing an ERP. However, it does not cover .PDF. The only way to automate Job launches by the ERP system (for automated printing) is to have a drawing directory in PNG format that will be supported by the ERP. and also, this ERP does not manage revisions.

Yes, I know, it's not practical.

However, in order to remedy this problem, I would like to make a macro for SolidWorks
2022, which would both create a PDF with the increment of the revision. This PDF will include all the sheets of the drawing, it will have to place them in a folder called archive which will include all the drawings with their revision increment (example: name fichier_R2). And another export, this one in .PNG that will create the images of the sheets and put them in the drawing folder. These images will not take into account the increment of the revision and will be overwritten each time the macro is activated.

I tried to modify a PDF/DXF export macro found on this site. On the other hand, I can't do it.

ExportMEPtoPdfDxf.swp (48 KB)

Could anyone help me?

Thank you in advance.

Hello
Want two separate macros?
What triggers macros, a button, or an event?
Are there several of you at the BE?

1 Like

In fact, it would be a macro button that would trigger the steps mentioned in the initial topic:

  1. creation of the PDF (all the sheets of the drawing) with increment of the revision in the archive folder.

  2. Creation of the PNG in the drawing folder without increment of the revision.

My increments are like this: file name followed by: _R0 ... _R1 ect... following the revision of the drawing.

Don't hesitate if you need more detail.

Kind regards.

Dessin_8

Is the revision stored in a property?
The folder is unique and all the PDFs and PNGs are stored flat?

2 Likes

Hello Remrem,

Yes, the revision is stored in the file's custom properties.
When you say flat stored, what do you mean?

Thank you.

Dessin_8

Is the property in the MEP file?
Flat = without sub-folders

2 Likes

Hello

The property is in SolidWorks.
PNG and PDF will not be in subfolders. So, effectively, flat.

Hello
So it's doable, you just have to change some of the code to export each sheet to PNG and store it in the right folders (you also have to give your folder structure unless you know how to code yourself).
It is also necessary to specify where the property containing the revision is stored (in the 3D or in the plan) because its retrieval by macro depending on where it is located will not be the same.
In summary, we need more information :smiley:

1 Like

That's exactly it. :+1:

Hello.

Here is an image of the process:

In summary, from a SolidWorks drawing (.slddrw), I press the button of the macro in question.

  • It creates a .PDF file on behalf of the SolidWorks file that will have the revision increment taken from the custom property of the current document. will deposit it in an Archive folder

  • Then, he creates a .PNG file, which will also have the name of the SolidWorks file, which on the other hand, will not have the increment of the current revision that will be deposited in the drawing folder. Every time I enable the macro, the new .PNG file will overwrite the old one.

In the image, the black box is for the macro. The rest is to help understand the ERP process.

I hope this will help you to better understand my request.