Macro to save a SW plan as a PDF with the revision index

 I'm looking for a macro that allows me to save a drawing in PDF by incorporating the revision index in the name

The revision index is a property of the part

I've searched a lot but I'm not an expert in VBA, I'm just tinkering

Small precision, I save my PDFs in the same directory as the drawing

Thank you

1 Like

See this link the answer is there

http://forum.solidagora.com/macro-api-solidworks-enregistrer-pdf-dxf-x-t101.html

@+-))

2 Likes

Otherwise, there's the batchconverter utility that does the same thing.

Here is a small macro that I made to save in PDF or DXF with an additional annotation, by modifying it a little bit you can manage to do something nice!


dxf_v2.swp
2 Likes

According to the Solidworks help, to get the revision you need

 

ISldWorks
Dim value As String
 
value = instance.RevisionNumber()

I don't know how you created your macro for PDF afterwards, but if we did it the same way, you add at the end of the line of the name which gives something like this

boolstatus = swpdfext. SaveAs(namePDF + value, 0, 0, swPDF, IErrors, IWarnings)

 

There you go. I hope it can help you

 

Edit: Oops, I didn't see that you wanted a full macro. David's must be very good then. (If you want another one, I had posted one in the dictaciel with explanations on each line)

Hi everyone

Thank you for your help and your quick answers but I've been working for an hour and nothing I try works

The macro on solidagora seems indecipherable to me

I can't get the macro of be3 to run with the choices and buttons

I tried to make a macro with the balls of coin37coin but it gets stuck

I'll try again tomorrow 

Good evening thank you

I tried a few hacks on my side too, but nothing conclusive.

However, I'm afraid you'll have to create a review table to do what you want. This would then allow you to obtain the revision number of the table and therefore include it in your registration name.... All that's left to do is find out how to do it :s

Hello

After putting my problem aside during the holidays I put it back this weekend

I found drafts on the net that I modified

and it works pretty well!!

I was even a little longer I converted to PDF and then to DWG all with the revision index of the part

Here's what it looks like


enregistrement_pdf_dwg__revision.swp