Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Watermark to SW Drawings 1

Status
Not open for further replies.

MDGroup

Mechanical
May 22, 2007
230
US
I have searched online and this questions seems to be asked many times, without a really good solution.

Is there any good (efficient) way to add a watermark to SW drawings - to be able to mark a print as 'Draft' or 'Preliminary' when saving it as a pdf?

In searching, the only solution I found is to 'Edit Sheet', place a text note, and select behind sheet.

This works good for a single sheet, but I have several drawings with 10+ drawing sheets that I need to add this to. I can't go into each sheet one at a time and add the note, only to delete it soon after when the drawing is released for real.

I was hoping there was something like in MS Word, where you just click to add a watermark, type what you want, and it appears on every sheet.


Thanks and Happy Holidays!
 
Replies continue below

Recommended for you

Are you use a PDM system? I know with PDM Pro you can use a variable to determine what is shown in such a note and set the variable to blank when the part is going through the approval process. Creating the PDF can then be automated as part of the approval process as well.

You could do the same thing manually. Setup a variable in the drawing template file properties. You can then the note like you are talking about but you set the print as the variable. Then when you change the variable it will update all the sheets.
 
GRF is correct. in PDM pro you can make that happen. If you don't have it then it's a manual operation. You can run it through the custom properties of the drawing if you want to, but it still has to be manually maintained.

Scott Baugh, CSWP [pc2]
CAD Systems Manager
Evapar

"If it's not broke, Don't fix it!"
faq731-376
 
You can create a macro to create a note on all the sheets, print, then remove the notes.
Try this:

Code:
Option Explicit
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swDraw As SldWorks.DrawingDoc
    Dim swSheet As SldWorks.Sheet
    Dim swNote As SldWorks.Note
    Dim swAnn As SldWorks.Annotation
    Dim swTextFormat As SldWorks.TextFormat
    Dim swView As SldWorks.View
    Dim swExportPDFData As SldWorks.ExportPdfData
    Dim SavePath As String
    Dim sheetNames As Variant
    Dim sheetName As Variant
    Dim boolstatus As Boolean
    Dim longstatus As Long
    Dim shtProps As Variant

    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swDraw = swModel
    sheetNames = swDraw.GetSheetNames
    '------ insert note on each sheet ------
    For Each sheetName In sheetNames
        boolstatus = swDraw.ActivateSheet(sheetName)
        Set swSheet = swDraw.GetCurrentSheet
        shtProps = swSheet.GetProperties
        swDraw.EditTemplate
        swModel.ClearSelection2 True

        Set swNote = swModel.InsertNote("<FONT color=0x000000ff>DRAFT")
        If Not swNote Is Nothing Then
            swNote.LockPosition = False
            boolstatus = swNote.SetBalloon(0, 0)
            Set swAnn = swNote.GetAnnotation()
            If Not swAnn Is Nothing Then
                longstatus = swAnn.SetLeader3(swLeaderStyle_e.swNO_LEADER, 0, True, False, False, False)
                Select Case shtProps(0)
                    Case swDwgPaperSizes_e.swDwgPaperCsize
                        boolstatus = swAnn.SetPosition(0.15, 0.15, 0)
                    Case swDwgPaperSizes_e.swDwgPaperBsize
                        boolstatus = swAnn.SetPosition(0.25, 0.2, 0)
                    Case Else
                        boolstatus = swAnn.SetPosition(0.1, 0.1, 0)
                End Select
                Set swTextFormat = swModel.GetUserPreferenceTextFormat(0)
                swTextFormat.Bold = True
                swTextFormat.Escapement = 0.4
                swTextFormat.CharHeight = 0.04
                boolstatus = swAnn.SetTextFormat(0, False, swTextFormat)
            End If
        End If
        swModel.ClearSelection2 True
        swModel.EditTemplate
        swModel.EditSheet
    Next
    '------ print ------
    Set swExportPDFData = swApp.GetExportFileData(1)
    swExportPDFData.ViewPdfAfterSaving = True
    SavePath = swModel.GetPathName
    SavePath = Left(SavePath, Len(SavePath) - 6) & "PDF"
    boolstatus = swModel.Extension.SaveAs(SavePath, 0, 0, swExportPDFData, 0, 0)
    '------ remove notes ------
    For Each sheetName In sheetNames
        boolstatus = swDraw.ActivateSheet(sheetName)
        Set swView = swDraw.GetFirstView
        Set swNote = swView.GetFirstNote
        Do While Not swNote Is Nothing
            If swNote.GetText = "DRAFT" Then
                Set swAnn = swNote.GetAnnotation
                boolstatus = swAnn.Select3(False, Nothing)
                swModel.EditDelete
            End If
            Set swNote = swNote.GetNext
        Loop
    Next
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top