OnApproveMasterDrawing.LST script file

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Event Scripts > NeutralFormat >

OnApproveMasterDrawing.LST script file

Description

It is placed in the DBWorks\LST directory.

It is called at Approval ( with the drawing NOT opened ): it adds texts/images/lines to the Master Drawing created at checkin time

Location

LST folder

Activation

The script is fired if existing and if the Master Drawing Mode is active

Output

@NO_FILE_LOCK

Optional.
0:lefts the Master Drawing PDF/TIF file readonly after the execution of the script
1:lefts the Master Drawing PDF/TIF file writable after the execution of the script

Remarks

When the following option is checked, DBWorks calls the OnApproveMasterDrawing.LST script with the parameter @MASTER_DRAWING_IS_CREATING set to "1".

Environment→Master Drawing Mode→ic_checkAlways Preview Checked-in Master Drawing if it exists

 

By checking this parameter, the script can decide to draw or not the revision table in the just created .PDF or .TIFF file.

@MASTER_DRAWING_IS_CREATING

is set to "1" if the script is creating a new .PDF or .TIFF file

Example

.VBSCRIPT

sub main()
 DBWInit(TRUE)
 '
 ' main input parameters
 '
 masterDrawingFileType = DBWInput("@MASTER_DRAWING_FILE_TYPE")
 masterDrawingDirectory = DBWInput("@MASTER_DRAWING_DIRECTORY")
 masterDrawingFileName = DBWInput("@MASTER_DRAWING_PATHNAME")
 '
 ' other useful inputs available
 '
 'DBWInput("@DOCUMENT_PATHNAME")
 'DBWInput("@DOCUMENT_FNAME")
 'DBWInput("@DOCUMENT_FEXT")
 'DBWInput("@DOCUMENT_FDIR")
 'DBWInput("@DOCUMENT_UNIQUE_ID")
 'DBWMsgBox("OnApproveMasterDrawing.LST!" & vbcrlf & masterDrawingFileName )
 DBWShell("MDOpen " & replace(masterDrawingFileName," ","|"))
 if okDBW = false then
  DBWMsgBox "Error opening Master Drawing " & masterDrawingFileName
  exit sub
 end if
 mdid = DBWResult("@MDID")
 x = 100 'mm
 y = 100 'mm
 text = "(100,100)"
 fontFaceName = "Arial,Italic"
 fontHeight = 10 'mm
 fontOrientation = 0
 style = 1
 rgbColor = RGB(0,0,0)
 DBWShell("MDAddText " &_
  mdid & " " &_
  x & " " &_
  y & " " &_
  replace(text," ","|") & " " &_
  replace(fontFaceName," ","|") & " " &_
  fontHeight & " " &_
  fontOrientation & " " &_
  style & " " &_
  rgbColor )
 x = 200 'mm
 y = 200 'mm
 text = "(200,200)"
 fontFaceName = "Arial,Italic"
 fontHeight = 10 'mm
 fontOrientation = 0
 style = 1
 rgbColor = RGB(0,0,0)
 DBWShell("MDAddText " &_
  mdid & " " &_
  x & " " &_
  y & " " &_
  replace(text," ","|") & " " &_
  replace(fontFaceName," ","|") & " " &_
  fontHeight & " " &_
  fontOrientation & " " &_
  style & " " &_
  rgbColor )
 x1 = 100 'mm
 y1 = 100 'mm
 x2 = 300 'mm
 y2 = 200 'mm
 style = 0
 width = 2
 color = RGB(255,0,0)
 DBWShell("MDAddLine " &_
  mdid & " " &_
  x1 & " " & y1 & " " & x2 & " " & y1 & " " &_
  width & " " & style & " " & color )
 DBWShell("MDAddLine " &_
  mdid & " " &_
  x2 & " " & y1 & " " & x2 & " " & y2 & " " &_
  width & " " & style & " " & color )
 DBWShell("MDAddLine " &_
  mdid & " " &_
  x2 & " " & y2 & " " & x1 & " " & y2 & " " &_
  width & " " & style & " " & color )
 DBWShell("MDAddLine " &_
  mdid & " " &_
  x1 & " " & y2 & " " & x1 & " " & y1 & " " &_
  width & " " & style & " " & color )
 DBWShell("MDClose " & mdid )
end sub