|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Commands Reference > CADSystem > RefreshVariantNotes |
Refreshes all the DBWorks variant notes of a SW drawing. The file can be opened or not, in the latter case it will be automatically opened and closed by DBWorks. The file can also be read-only, in which case it will be temporarily unlocked for the time necessary to the operation. The purpose of this command is to solve some particular cases in which you can modify some fields in the database after that the normal database operations of DBWorks are completed. One of such cases is to modify some fields in the database from the DBWTRAN.LST event procedure.
The command can be called with or without the optional argument drawing_unique_id; if without, you must first select a drawing in the DBWorks browser, and then call this function.
call DBWShell("RefreshVariantNotes [ drawing_uid [ not_save_drawing ] ]")
drawing_uid |
Optional. drawing unique Id |
|---|---|
not_save_drawing |
Optional.if equal to 1, the drawing will not be saved (default = 0) |
If no drawing unique id is passed, DBWorks browser must be open.
The not_save_drawing parameter is used for controlling if the drawing file must be saved or not. When used, the 1st optional parameter must be declared ( even if with a 0 for using the current active document ).
This sample simply reads the value of the field ITEM_CODE, and increment this value by one, asking the refresh of the selected drawing; of course, the drawing itself must contain a variant note of the type @DBW=DRAWING.ITEM_CODE so that the database modification can be seen.
Sub Main()
DBWinit(TRUE)
DBWShell("GetSelection")
if okDBW=FALSE then exit sub
uid = DBWResult("@SELECTION")
itemCode = DBWQueryByUid(uid,"ITEM_CODE")
if itemCode = "" then
itemCode = "1"
else
itemCode = CStr( CInt(itemCode)+1 )
end if
DBWExecSql("UPDATE DOCUMENT SET ITEM_CODE='" & itemCode & "' WHERE UNIQUE_ID=" & uid )
DBWShell("Wait 500")
call DBWShell("RefreshVariantNotes")
end sub
Sub Main()
DBWinit(TRUE)
uid = 47587 ' the known unique id of a drawing
itemCode = DBWQueryByUid(uid,"ITEM_CODE")
if itemCode = "" then
itemCode = "1"
else
itemCode = CStr( CInt(itemCode)+1 )
end if
DBWExecSql("UPDATE DOCUMENT SET ITEM_CODE='" & itemCode & "' WHERE UNIQUE_ID=" & uid )
DBWShell("Wait 500")
call DBWShell("RefreshVariantNotes " & uid)
end sub