
Take a look inside 2007 release


MechWorks s.r.l.
via Vallescura, 8/2
40136 - Bologna, Italy
http://www.mechworks.com
This tool is a reference for the Administrator displaying a centralized directory
of the administrative tools available in DBWorks.
A simple web interface offers a brief explanation for each topic, a link to the help for more information
and often the ability to open a dialog for direct editing.
This tool allows to copy or move the content of entire projects into other projects.
The interface displays two panels: from and to allowing to select the source projects and the destination project.
For a detailed selection you are able to filter the files using a textual search or select/deselect the file manually.
A confirmation dialog allows you once more to check the list of files to be moved or copied across the projects.
Note that the disk location of the documents is not changed, only the assignment to projects is affected.

A proprietary DWG Viewer is now available in DBWorks 2007 for the preview and the full preview of DWG files (up to the Autocad 2007 file format).
The viewer, when used in the Full Preview tab, can zoom/pan the DWG, supports multiple sheets DWG, show the selected layers and print (with full Print Preview capability) the DWG.
It's now possible to assign the physical quantity directly from the Create a new Bom Item dialog.
A physical quantity of 0 will reset the physical quantity and unit of measure assignments.

The Insert New Bom Item default directory is now set equal to the parent’s document directory.
If the parent’s document directory is empty, the directory is assigned to the XLS directory.
Two new options are available in the Order BOM Position Numbers dialog

Two new options are available in the Open/Save→Save section:
Open/Save→Save→
Always assign absolute BOM position numbers on save
Open/Save→Save→
Force CAD order only if not absolute
When checked, the functionality Order BOM Position Numbers is automatically applied at each assembly save. For an explanation of these concepts, please read the paragraph New options in the "Order BOM Position Numbers" dialog
The table names must be localized in each language, following the standard rules of the TABLES2.DFL DBCustomizer will manage all these issues automatically.
Tables2.DFL
… @ORDER SEARCH DESCRIPTION @ORDER COMPOSED_OF T,DESCRIPTION @ORDER DRAWING SHEET_FORMAT @ORDER PROJECT CREATION_DATE …In the above example:
The LAST_MODIFIED_DATE and LAST_MODIFIED_BY fields are now always aligned at check-in for all the configuration records of the same file,
so being no more necessary to set the option Environment→Configurations→
Align fields on configuration checkin
In the Remote Access case, also the REPLICATION_DIRTY flag is correctly set
Inserting a part into a weldment structure generates both a derived-part relation and a cut-list item in the parent part:

DBWorks marks now as NO_BOM the cut-list records generated by a part (in the above example, the Cut-list-item3(1)):

This enhancement allows to create a correct BOM:





The new macro name $(CONFIGURATION_DESCRIPTION) can be used in the options:
Data Input→Macro definition for configured record ID
and
Data Input→Macro definition for configured record DESCRIPTION



The new macro $LINKED_FIELD allows the display of linked tables values, even if in full UNICODE format ( NVARCHAR ). So, for example, by using this macro it will be possible to display a Unicode Secondary Table value in the Input Form and in the Data Grids.
$LINKED_FIELD(<DOCUMENT_table_key_field>,<Linked_Table_Name>,<Linked_Table_Field>,"<SQL_variant_filter>")
We would like to display both an English and a Chinese description in the same Input Form.
The English description will be contained in the field DESCRIPTION, the Chinese description in the field DESCRIPTION2.
Suppose that our DBW_UNICODE_MAPPING_TABLE contains the following records:

We will assign to the field DESCRIPTION2 the value:
$LINKED_FIELD(DESCRIPTION,DBW_UNICODE_MAPPING_TABLE,SECONDARY_STRING,"PRIMARY_STRING='%s' AND SECONDARY_LANGUAGE='CHINESE'")
In this macro:
<DOCUMENT_table_key_field> = DESCRIPTION
<Linked_Table_Name> = DBW_UNICODE_MAPPING_TABLE
<Linked_Table_Field> = SECONDARY_STRING
<"SQL_variant_filter"> = "PRIMARY_STRING='%s' AND SECONDARY_LANGUAGE='CHINESE'"

Whenever the edit control will loose its focus, the displayed result will be the following:

More, the same value will be displayed in the standard Data Grids:

Of course, the DESCRIPTION2 field could be easily populated for all the documents with the above macro, by simply writing a DESCRIPTION2.LST with a proper .DEFAULT directive:
.DEFAULT $LINKED_FIELD(DESCRIPTION,DBW_UNICODE_MAPPING_TABLE,SECONDARY_STRING,"PRIMARY_STRING='%s' AND SECONDARY_LANGUAGE='CHINESE'")
There is no more need for the final STOP/SET DB DBWORKS/START sequence when accessing a different database.
Old way (DBWorks 2006):
.SQL STOP; SET DB DBWCUST; START; SELECT ... STOP; SET DB DBWORKS; START;
New way (DBWorks 2007):
.SQL STOP; SET DB DBWCUST; START; SELECT ...

Never show Projects if not assigned…
Tools Setup
Edit Material Database,system\edit_material.vbs,120
Custom Property Manager,system\bomcust.vbs,53
Office Integration Parameters,system\Officetemplates.vbs,52
Define Revision schema,system\Edit_Revisions_schema.vbs,56
Register Documents in the Database,system\Register_Documents_in_Dbworks.vbs,63
[DBWARM:Group:DBWorks Admin]Bom Designer wizard,system\EditExcelBOMs.vbs,132
ME10 Integration Parameters,system\ME10Setup.vbs,139
DBWorks Conversion Wizard,system\dbworks_conversion_wizard.vbs,86
Select Coding Wizard,system\SelectCodingWizard.vbs,106
[DBWARM:Group:DBWorks Admin]Visual Cues Manager,system\visual_cues_manager.vbs,106
…

DBWorksApplicationName DBWARM_Action USER_ADDED | USER_REMOVED | USER_MODIFIED DBWARM_UserName DBWARM_UserFullName DBWARM_UserGroup DBWARM_UserNameWas Not null if DBWARM_Action is USER_MODIFIED
' ' OnDBWArmUsersTableUpdated.VBS ' MsgBox "OnDBWArmUsersTableUpdated.VBS" & vbcrlf &_ "Application : " & DBWorksApplicationName & vbcrlf &_ " Action : " & DBWARM_UsersTableAction & vbcrlf &_ " User name : " & DBWARM_UserName & vbcrlf &_ " Full name : " & DBWARM_UserFullName & vbcrlf &_ " Group : " & DBWARM_UserGroup &_ " User name was : "& DBWARM_UserNameWas
The DBW_ATTACHMENTS table must have the following minimum structure:
T varchar(1) DESCRIPTION varchar(80) FILE_NAME varchar(256) FILE_DIRECTORY varchar(256) REVISION varchar(20) DOCUMENT_UNIQUE_ID int
A new RMB popup menu entry Add an Attachment … is available for selecting the files to be attached to the currently selected document:

.VBSCRIPT
sub main()
DBWInit(TRUE)
' the parent document unique id
documentUniqueId = DBWInput("@DOCUMENT_UNIQUE_ID")
' to be used for revision-dependent attachments ; still not supported
documentRevision = DBWInput("@DOCUMENT_REVISION")
if documentUniqueId = 0 then
exit sub
end if
nameFieldT = DBWLookUp("NAME_FIELD_T")
nameFieldDESCRIPTION = DBWLookUp("NAME_FIELD_DESCRIPTION")
nameFieldFILE_NAME = DBWLookUp("NAME_FIELD_FILE_NAME")
nameFieldFILE_DIRECTORY = DBWLookUp("NAME_FIELD_FILE_DIRECTORY")
nameFieldDOCUMENT_UNIQUE_ID = DBWLookUp("NAME_FIELD_DOCUMENT_UNIQUE_ID")
' build the tab query
query =_
"SELECT " &_
nameFieldT & "," &_
nameFieldDESCRIPTION & "," &_
nameFieldFILE_NAME & "," &_
nameFieldFILE_DIRECTORY & "," &_
nameFieldDOCUMENT_UNIQUE_ID &_
" FROM DBW_ATTACHMENTS WHERE " &_
nameFieldDOCUMENT_UNIQUE_ID & "=" & documentUniqueId
' return the query to DBWorks
DBWOutput "@QUERY",query,ForWriting
end sub
To activate the script, simply copy it in the LST folder.
The preview of the attachments is supported within the range of types supported by the available installed viewers.
Full preview of generic documents
Full preview of generic documents launching the associated applications




Starting from sp1.0 (planned for summer 2007) DBInventor 2007 will be ready for Inventor 2008.
Align DrawingsÛPart Fields
This new parameters enables the logging of any error that may happen while processing the file’s custom properties. A special Log file, named DBW_CustomPropertiesMonitor.LOG, is written in the %TMP% directory.
It's suggested only when experiencing problems with the file custom properties.The new function Copy Master Drawing file names to clipboard is available from the RMB Working Set menu:

When applied to the current Working Set, DBWorks will look for any available Master Drawing file for the documents in the Working Set, and copy the file names to the clipboard, so to allow a further Paste operation from any Windows application:



In order to provide the necessary file locations parameters to the SolidWorks Document Manager, a new option has been added in the General→More … section:

As indicated in the option’s title, you must assign only the ROOTS of the repository folders for the SW files to be registered.
The registration process considers also all the Options→Environment→Configurations parameters, included the
Save all configurations automatically.
For such reason, the parameters are now enabled in the Options→Environment→Configurations page when started from a DBWorks Standalone system.
The corresponding DBWShell command ( AddDocument ) has now a 3rd optional parameter for traversing an assembly structure:
DBWShell("AddDocument <document path name> [ <parent unique ID> [ <registerChildDocuments> ] ]")DBWShell("AddDocument C:\MyAssemblies\MyAsm.sldasm 123456 1")
Set DBWApp = CreateObject("DBWAlone.Api")
okDBW = DBWApp.CallBack( "@StartApplication" ) 'support for DBWArm/Login dialog
asmName = replace("C:\MyAssemblies\MyAsm.SLDASM"," ","|") 'the assembly is known to the script
parentUid = 123456 'the parentUid is known to the script
traverseChildComponents = 1
okDBW = DBWApp.CallBack("AddDocument " & asmName & " " & parentUid & " " & traverseChildComponents )
Batch plotting of DWG/DXF files is now supported through the eDrawings viewer (if available).

A new option (by default unchecked) in the Plot Setup page is available for eDrawings plotting from a DBWorks Standalone system:
Use Draft quality when plotting with eDrawings from DBW Standalone
When using this option, the needed memory resources are much less than when plotting with standard quality, but, of course, the resulting plotting quality is low.
Choose configuration when opening a document
sub main()
DBWInit(TRUE)
call DBWShell("MDOpen C:\MyPdfFiles\MyPdfFile.pdf 1")
mdid = DBWResult("@MDID")
if mdid<>0 then
rgbcolor = rgb(255,0,0)
DBWShell("MDAddText " & mdid & " 10 10 APPROVED!!! Arial 18 0 0 " & rgbcolor & " 0")
DBWShell("MDClose " & mdid)
end if
end sub

Plot Multiple Sheets.

Any already downloaded foreign document is now highlighted in RED color if the LAST_MODIFIED_DATE value is newer than the file date.
The download of a foreign document in checked-out state is now allowed by DBWorks.
The document being downloaded, however, is the last approved revision of the document being checked-out, so to permit to the company requesting the foreign document to access the document, even if the document is currently in a new revision phase on the remote company that owns it.
DBWorks can now preview foreign documents even if the server-side-file-transfer modality is enabled.

At each save, DBWorks will update the field with a low-resolution image of the document being saved.
The low-resolution image will then be used by the Download functionality for previewing the document.
Environment→Remote Access→
Always download linked documents
Two new commands:
Under DBWArm, both commands are available if the user has the Create new Project priviledge

After a successful Rename, DBWorks applies now the following options (if assigned):
Save drawings on a separate project
Save drawing on the Part/Assembly's project
Assign project by component prefix or directoryA new set of options controls the automatic creation of Excel_BOMs or file exports at checkin or approve time (see main help for details).
The available Output File Extensions must be declared into the parameter file SCHEMA\DBWRevisionsOutputFileExtensions.TXT.
An example of this parameter file is the following:
;-------------------------------------------------------------- ; DBWRevisionsOutputFileExtensions.TXT ; ; DBWorks Revisions Output File Extensions File ; ;-------------------------------------------------------------- ; EXTENSION <extension> EXTENSION PDF EXTENSION TIF EXTENSION DWG EXTENSION DXF EXTENSION DWF EXTENSION IGS <empty line>
The created Excel_BOMs are accessable through new RMB menu entries:

From the Previous Revisions Grid interface:
Open ExcelBOM – opens the ExcelBOM created for the selected ( approved ) revision

The new command @GETNEXTFROMSCRIPT can be used in the REVISION.LST file for assigning a default handler of the revision name builder, without the need to activate the OnNewRev.LST script.
@GETNEXTFROMSCRIPT MyOnNewRev.LST
If a Project will be used as Revisions Container, it must be set to a RELEASED state.
In the picture below, the Generic Document with ID=”RevisionsContainer” has the DBW_EC_TYPE set to an arbitrary value; the PARENT_CHILD_REVISION value for the PARENT_CHILD relation between the “RevisionsContainer” Generic Document and the “Wilwood Master Cylinder” Assembly Document is set to “B”.
On the top of the picture, you can see that the “Wilwood Master Cylinder” Assembly is displayed with its current database relations and values, while in the sub-tree under the “RevisionsContainer” Generic Document, the same assembly is displayed with its structure at Revision=”B”. It is interesting to note that the component “Reservoir Cover” has been deleted from the database, so it is represented in the Tree as an OBSOLETE document.
The markers and on the right side of each ID help to remember that the structure is not available in the database, but it has been loaded from a .TREE revision file.

New comparison html output view for tree files. The tool can be activated to compare revision of assemblies be removing or renaming the local file ...\DBWorks\bin\dbwdiff.exe
The ability to create and display the view is also offered by API as a function of the object DBWJComp.CodeObject. method: showComparisonAsWebPage <treeFileFullPath1>,<treeFileFullPath2> and can be used from scripting as in the following VBScript example:
Set codeObject = CreateObject("DBWJComp.CodeObject")
codeObject.showComparisonAsWebPage "C:\myAsm.SLDASM.03.TREE","C:\myAsm.SLDASM.02.TREE"
Set codeObject = Nothing
where the last revision (or the main referenced tree) should be passed as the first parameter, for compatibility with the DBWorks native Compare command.

DBW2007 introduces the support for native .CS or .VB applications written in .NET
DBW2007 uses a custom engine (named DBWCSSUI) for driving the .NET runtime.
This engine needs some extra coding for managing correctly the assembly references.
Any given .NET assembly has the following major characteristics:
The naming convention for the .NET framework was always simple: all three are the "same".
Microsoft has broken it's own rule with the way how Visual Studio 2005 generates interops: the file name always has prefix "interop." and does not match any more the assembly namespace. What leads to the situation when it is not possible to reconstruct the file name from the assembly namespace (this is what the DBWCSSUI engine does).
The solution is to use the DBWCSSUI explicit loading directive //css_ref : this resolves the loading problem.
About how to reference the namespace from the code, in C# it is resolved through the using directive; VB equivalent is Import.
Thus if you want to use, for example, System.Windows.Forms your code needs to have Import System.Windows.Forms.
In addition to this, VB compiler has it's unique feature imported namespaces which means that you can nominate namespaces to be used not from code but on the compiler level.
This is the reason why you do not have to have Import System.Windows.Forms in the code if you are inside of the VB project: nice feature but inconsistent and creates some confusion.
DBWCSSUI does not pass any extra compiler directives thus you must have Import <namespace> in code if you want to use a particular namespace.
As a final note, renaming of the assembly file is not a very good idea in general as it creates mismatch between Assembly file and module name. Some applications may refuse to load such assemblies.
CacheBaseDir: The root directory for caching the local script compilation results.
DownloadBaseDir: The root directory for downloading (caching) all remote scripts.
CodeProviderDll: Location of the VB compiler assembly. This value is passed at run time to the CS-Script engine through it's configuration file.
DebugMode: Boolean flag, which indicates that the script should be compiled with debug information included.
SimpleRemoteCaching: Boolean flag, which indicates when the remote script dependency files (assemblies and importable scripts) have to be analysed for changes.
VSBaseDir: Root directory where all temporary C# and VB projects are generated.
VSCleanResx: Boolean flag, which indicates that any automatically generated .resx files (for temporary VS project) should be deleted on after closing the IDE.
VSUpdateIncludesOnClose: Boolean flag, which indicates that new //css_imp should be automatically injected to the script file after closing the IDE. The injection is usually triggered by adding .cs/.vb file to the project by developer. New directives are marked with "//auto-generated" comment.
VSUpdateRefsOnClose: Boolean flag, which indicates that new //css_ref should be automatically injected to the script file after closing the IDE. The injection is usually triggered by adding assembly references to the the project by developer. New directives are marked with "//auto-generated" comment.
For each "standard" script ( *.LST or *.SPT ), DBWorks 2007 looks if a .NET version exists in the same directory.
The .NET version has the naming convention:
The following is an example of OnOK.LST.CS:
//css_reference MW.DLL;
using System;
using System.Drawing;
using System.Windows.Forms;
public class DBWDotNet
{
static public string Main(
string ApplicationName,
string ModuleName,
string ConnectionDSN,
string ConnectionUID,
string ConnectionPWD,
string ConnectionDBMSName,
string ConnectionORACLE_SERVER,
string ConnectionORACLE_SCHEMA_OWNER,
string ConnectionBomDSN,
string IsInBatchOperation,
string CurrentDocumentBatchOperationIndex,
string BatchOperationDocumentsCounter
){
MW.DBWLib.Initialize(ApplicationName,ModuleName,ConnectionDSN,ConnectionUID,ConnectionPWD,ConnectionDBMSName,ConnectionORACLE_SERVER,ConnectionORACLE_SCHEMA_OWNER,ConnectionBomDSN,IsInBatchOperation,CurrentDocumentBatchOperationIndex,BatchOperationDocumentsCounter);
String fileName;
fileName = MW.DBWLib.DBWInput("FILE_NAME");
MessageBox.Show("FileName=" + fileName);
MW.DBWLib.DBWOutput("@OKDATA","1",MW.DBWLib.ForWriting);
String description;
description = "Created By OnOK.LST.CS";
MW.DBWLib.DBWOutput("DESCRIPTION",description,MW.DBWLib.ForAppending);
MW.DBWLib.Terminate();
return "";
}
}
Looking at the above script, you can see the following features:
The same example shown above can be written in VB.NET as follows:
'//css_reference MW.DLL;
Imports Mechworks
Imports Microsoft.VisualBasic
Public Class DBWDotNet
Public Shared Function Main(ByVal ApplicationName As String,ByVal ModuleName As String,ByVal ConnectionDSN As String,ByVal ConnectionUID As String,ByVal ConnectionPWD As String,ByVal ConnectionDBMSName As String,ByVal ConnectionORACLE_SERVER As String,ByVal ConnectionORACLE_SCHEMA_OWNER As String,ByVal ConnectionBomDSN As String,ByVal IsInBatchOperation As String,ByVal CurrentDocumentBatchOperationIndex As String,ByVal BatchOperationDocumentsCounter As String) As String
MW.DBWLib.Initialize(ApplicationName,ModuleName,ConnectionDSN,ConnectionUID,ConnectionPWD,ConnectionDBMSName,ConnectionORACLE_SERVER,ConnectionORACLE_SCHEMA_OWNER,ConnectionBomDSN,IsInBatchOperation,CurrentDocumentBatchOperationIndex,BatchOperationDocumentsCounter)
Dim fileName as String
fileName = MW.DBWLib.DBWInput("FILE_NAME")
MsgBox("FileName=" & fileName)
MW.DBWLib.DBWOutput("@OKDATA",1,MW.DBWLib.ForWriting)
if ucase(right(fileName,7))=".SLDPRT" then
Dim id as String
id = left(fileName,len(fileName)-8)
Dim description as String
description = id & " - Created By OnOK.LST.VB"
MW.DBWLib.DBWOutput("DESCRIPTION",description,MW.DBWLib.ForAppending)
end if
MW.DBWLib.Terminate()
return ""
End function
End Class
Looking at the above script, you can see the following features:
The UserProcessDocument function, necessary to the DBWWalkTree functionality, it is supported by creating a special module named:
DBWWalkTree_UserProcessDocument.VB
with a template like:
' //css_reference MW.DLL;
' //css_reference MechWorks.Interop.DBWAlone.DLL;
Imports Mechworks
Imports Microsoft.VisualBasic
Public Class DBWDotNetUserLib
Public Shared Function UserProcessDocument( ByVal uniqueId As String ) As String
MsgBox(">>UserProcessDocument<< uniqueId=" & uniqueId)
return "0"
End function
End Class
The function UserProcessDocument is invoked by the MW.DBWLIB.DBWWalkTree for allowing the programmability of the actions on each document being processed.
An Add-in is a generic application, written in any language ( even .NET ), exposing, thorugh a Visual Basic COM interface, the following four functions:
Start(BSTR applicationName) Stop() OnMenuItemClicked(long itemID) OnMenuItemEnabled(long itemID)
An add-in template, written in VB.NET is the following:
Imports System.Runtime.InteropServices
<Microsoft.VisualBasic.ComClass()> Public Class Class1
Public Function Start(ByVal AppName As String) As Boolean
MsgBox("Start")
Start = True
End Function
Public Function [Stop]()
MsgBox("Stop")
End Function
Public Function OnMenuItemClicked(ByVal itemID As Integer) As Boolean
MsgBox("OnMenuItemClicked " & itemID)
Return True
End Function
Public Function OnMenuItemEnabled(ByVal itemID As Integer) As Boolean
If itemID = 3 Then ' just for testing, disable item = 3
Return False
End If
Return True
End Function
End Class
It is important that the following attributes must be set for the add-in:

DBWorks 2007 launches at startup a special script named AddinStartup.VBS, located in subfolders of the special folder BIN\AddIns.
From within the startup script, the DBWShell(“LoadAddin …”) command must be invoked, passing the name of the add-in, the CLSID of the COM object to be installed and the XML file for the definition of the menus.
If the loading of the add-in’s DLL will be successful, the Start(BSTR applicationName) method will be invoked by DBWorks.
When DBWorks will stop its execution, the method Stop() will be invoked for each loaded add-in.
DBWShell("LoadAddin <Addin name> <Addin ProgID> <Addin XML menu definition file>")
Where:
Addin name any unique name for the add-inThe supported format of the XML file for the menu structure is the following:
<?xml version="1.0" encoding="utf-8" ?> <DBWMenu> <DBWSubMenu Name="My1stAddinMenu"> <DBWMenuItem Name="Func1" ID="5"></DBWMenuItem> <DBWMenuItem Name="Func2" ID="6"></DBWMenuItem> <DBWSubMenu Name="MySubMenu1"> <DBWMenuItem Name="Func3" ID="1"></DBWMenuItem> <DBWMenuItem Name="Func4" ID="2"></DBWMenuItem> </DBWSubMenu> <DBWSubMenu Name="MySubMenu2"> <DBWMenuItem Name="Func5" ID="3"></DBWMenuItem> </DBWSubMenu> <DBWSubMenu Name="MySubMenu3"> <DBWMenuItem Name="Func6" ID="4"></DBWMenuItem> </DBWSubMenu> </DBWSubMenu> <DBWSubMenu Name="My2ndAddinMenu"> <DBWMenuItem Name="Func7" ID="7"></DBWMenuItem> <DBWMenuItem Name="Func8" ID="8"></DBWMenuItem> </DBWSubMenu> </DBWMenu>
The attributes ID must be UNIQUE in the file, being those numbers passed to the functions OnMenuItemClicked(long itemID) and OnMenuItemEnabled(long itemID)
sub Main()
DBWInit(True)
DBWShell("LoadAddin MyDBWAddin ClassLibrary1.Class1 AddinMenu.xml")
End Sub
Using the XML menu definition file described in the above example, the displayed menu structure will be the following:

The DBSQL engine supports now the following commands for loading/saving a file into a BLOB-type (Binary Large OBjects) database field:
FILELOAD <table name> <key field name> <key field value> <BLOB field name> <file path> FILESAVE <table name> <key field name> <key field value> <BLOB field name> <file path>
To insert the file C:\MyPictures\MyPicture.JPG file into this field for a record with UNIQUE_ID=123456789:
DBSQL>FILELOAD DOCUMENT UNIQUE_ID 123456789 DBW_PREVIEW_IMAGE C:\MyPictures\MyPicture.JPG;
To extract the image from the same record to the file C:\MyPictures\MySavedPicture.JPG:
DBSQL>FILESAVE DOCUMENT UNIQUE_ID 123456789 DBW_PREVIEW_IMAGE C:\MyPictures\MySavedPicture.JPG;
Both commands can be invoked from a .LST/.VBS script as follows:
sub main()
DBWInit(TRUE)
DBWExecSQL("FILELOAD DOCUMENT UNIQUE_ID 123456789 DBW_PREVIEW_IMAGE C:\MyPictures\MyPicture.JPG;")
MsgBox "OK LOAD =" & okDBW
DBWExecSQL("FILESAVE DOCUMENT UNIQUE_ID 123456789 DBW_PREVIEW_IMAGE C:\MyPictures\MySavedPicture.JPG;")
MsgBox "OK SAVE =" & okDBW
end sub
DBWShell("FileZip <command> <file path>")
DBWShell("FileZip New " & replace("C:\MyFolder\MyZipArchive.ZIP"," ","|"))
DBWShell("FileZip Add " & replace("C:\MyFolder\MyFile.DOC"," ","|"))
DBWShell("FileZip Create")
DBWShell("FileUnZip <zip file path> <output folder>")
Sets the names of the Primary Database Tables to the assigned ones.
DBWShell("SetPrimaryDatabaseTables <permanent> <DOCUMENT table name> <REVISIONS table name> <PARENT_CHILD table name>")
<permanent> [0/1] if 1, the primarty tables are pemanently set to the new names (useful for starting a Standalone Client on a new primary tables set)
if 0, the table will be reset as soon as the script terminate its execution
When the Primary Tables are different from the standard ones, the DBWorks Browser shows a notification in it’s title

DBWShell("SetPrimaryDatabaseTables 0 DBW_ASBUILT_DOCUMENT DBW_ASBUILD_REVISIONS DBW_ASBUILT_PARENT_CHILD")
The following command resets the Primary Database Tables to their original values
DBWShell(“ResetPrimaryDatabaseTables”)
EMail <action> <parameter> <value>
where: <sent to User identifier> <user ID>@<company ID>
<parameter> BODY_TXT
<value> a line in text format for the body of the eMail message
<parameter> BODY_HTML
<value> a line in HTML format for the body of the eMail message
<parameter> ATTACHMENT
<value> a valid file path for sending the file as attachment to the eMail message

A new command GetTreeParentProject is available in the DBWShell interface.
The command returns the Unique ID of the nearest Parent Project in the current Tree structure.
When used with no parameters, it returns the nearest Parent Project Unique ID of the currently selected item in the Tree. When invoked passing a Unique ID as parameter, it first tries to select a document in the current Tree with the Unique ID equal to the one passed as parameter, then returns the nearest Parent Project in the Tree structure.
See CommandShell documentation for details.

This script is fired when dropping a set of files/documents on a target document.
Please refer to DBWShellCommand documentation for details.
It allows to customize the text that is displayed in the label of the Preview window of a document.

Please refer to DBWShellCommand documentation for details.
The ShowConfirmationDialog command has been enhanced for supporting the deletion of records and files, in the same way the user interface does.
Please refer to DBWShellCommand documentation for details.
Please refer to DBWShellCommand documentation for details.
A new optional parameter is available for passing the name of a field that will be displayed when the Data Input Form will be opened. Due to this is possible to change the default tab shown when dialog is displayed.
call DBWShell ("EditRecord 45 1 CATEGORY3")
because the field CATEGORY3 is shown in tab "Classification", such tab is shown as active when the dialog is opened.

Please refer to DBWShellCommand documentation for details.
When called with no parameters, and if a Tree control was activated with a valid selection, it displays the UI Create a new Bom Item dialog.
Please refer to DBWShellCommand documentation for details.
For the PDF case only, the command applies the setting of the option Plot setup→
Plot multiple sheets
Please refer to DBWShellCommand documentation for details.
Please refer to DBWShellCommand documentation for details.
Starting from sp1.0 (planned for summer 2007) DBWorks 2007 will be installable in a special edition for running with SolidWorks 2007 x64 edition.
DBWorks can be run under Vista Operating System.
When checked, DBWorks will apply the new material (selected through the DBWorks Material Editor) to each configuration. DBWorks will also coherently update the Custom Properties for each configuration.
The option emulates the behavior of the following SolidWorks Edit Material Property Manager option:


The Dataentr.LST script (Save Wizard) can now output, if needed, the following parameters:
SolidWorks@ConfigurationProperty@Name
SolidWorks@ConfigurationProperty@Description
SolidWorks@ConfigurationProperty@Comment
SolidWorks@ConfigurationProperty@AlternateName
Sub main() … … DBWOutput "SolidWorks@ConfigurationProperty@Name","MyNewCfgName",ForAppending … End sub
The current configuration will be renamed as

The Summary Info properties can now be imported by declaring the following identifiers in the CustProp.txt ( or CustProp_Insert.txt ) file:
"SW_Title"
"SW_Subject"
"SW_Author"
"SW_KeyWords"
"SW_Comment"
"SW_SavedBy"
"SW_CreateDate"
"SW_SaveDate"
CustProp.txt
DESCRIPTION "SW_Title" NOTES "SW_Comment"
toolbar button, then the native SolidWorks File→Save As… dialog will be displayed, so allowing the export of the file in different formats.
Use 'DataEntr.LST' on Toolbox Components is available for controlling that, when a Toolbox component is dropped into an assembly, DBWorks will call the Dataentr.LST (Save Wizard) script, passing @CONTEXT=GET_FILENAME_BEFORE_DROP as context.
Please look at the Behavior Changes section for the changes applied to the List Locked Files functionality.
The following options:
User Interface→Browser Behavior→
Disable Assembly grid
Disable Parts grid
Disable Drawings grid
Disable Generic Document's gridcontrols now the existance of the Assembly, Part, Drawing and Other Documents tabs in the Tree Page’s Grids area
A new tab named Configurations shows all the configured distinct records of the currently selected document:

The list of displayed fields is dynamically exchanged between the list for the Part type documents and the Assembly type documents, depending from the currently selected document type.
It is now possible to display custom query tabs in the Tree Page.
DBWorks will display as many tabs as the number of scripts .LST with the prefix OnCustomQueryTab_
Each script must return the output parameter @QUERY containing the query to be displayed in the Tree Page Tab.
Suppose we want to show quickly the parts that have a LENGTH similar to the selected part.
We will create a script named OnCustomQueryTab_SimilarLength.LST in the shared LST directory, as follows:
.VBSCRIPT
sub main()
DBWInit(TRUE)
uid = DBWInput("@DOCUMENT_UNIQUE_ID")
if uid = 0 then
exit sub
end if
length = DBWQueryByUId( uid, DBWLookUp("NAME_FIELD_LENGTH") )
if length = 0 then
exit sub
end if
lengthMax = length * 1.1
lengthMin = length * 0.9
query = _
"SELECT "&_
DBWLookUp("NAME_FIELD_T") & "," &_
DBWLookUp("NAME_FIELD_ID") & "," &_
DBWLookUp("NAME_FIELD_LENGTH") &_
",*" &_
"FROM " &_
DBWLookUp("NAME_DOCUMENT_TABLE") &_
" WHERE " &_
DBWLookUp("NAME_FIELD_LENGTH") & ">=" & lengthMin &_
" AND " &_
DBWLookUp("NAME_FIELD_LENGTH") & "<=" & lengthMax &_
";"
' return the query to DBWorks
DBWOutput "@QUERY",query,ForWriting
end sub
The result in the Tree Page will be the display of a new tab named SimilarLength:

![]()
The RMB→Find a Document … functionality works now also on Projects kepts closed for performance issues.
DBWorks checks if the document to be searched is between the children of the selected project and expands it only when needed.
Enable drag-and-drop in Trees
Enable drag-and-drop on Assemblies
Only for fake componentsThe new sub-option allows the drag&drop of components into existing assemblies only if the components have been created with the Create New Bom Item functionality (fake components).

The options change the global User Interface style for the current user.
A new sub-folder named Styles, located under the SCHEMA\IMG folder, contains the available style files.
The style named MechWorksStyle.Default is the one used by DBWArm and other applications with no Users parameters.

The display of the Checked-out-by-others, Not-revision-managed, Standard-part attribute has been enhanced.
Generic Documents are now always displayed with the correct type icon independently of the above attributes state.
It is now possible to define some hot-keys through the definition file SCHEMA\DBWHOTKEYS.TXT, or, in it’s user specific version, USERS\<user name>\DBWHOTKEYS.USR.
Both files are managed by DBCustomizer.
;=================================================================== ; ; DBWorks2007(C)MechWorks Hot-keys definition file ; ; Format: ; ; HOT-KEY-ID <DBWShell command> | <@SpecialCommand> ; ; Where: ; HOT-KEY-ID F1|F2|F3|...|F12|0|1|2|...|9|A|B|C|...|Z ; ; HOT-KEY-ID can be prefixed by CTRL- or SHIFT- for applying the hot-key ; only when the CTRL or SHIFT keys are pressed ; ; The allowed special commands are: ; @SEARCH move the input focus in the [SEARCH] edit box ; ;=================================================================== CTRL-A Checkout SHIFT-A Checkin F5 Requery CTRL-Q @SEARCH CTRL-B ExecScript CalledFromHotKey.vbs
It has been removed the limitation on max 700 rows to be copied in the clipboard. The Ctrl+C can copy an entire large grid, and the result is available for pasting into MS Excel or any other Windows application.
Show Enhanced Tooltips in Delete/Plot Dialog Grid


The following message boxes have been enhanced for supporting the “[X] Do not show this message again” check-box:

DBWorks 2007 supports now multiple Visual Cues Definition files.
The purpose is to allow the user to display sets of Visual Cues, depending from specific conditions he likes to highlight.
The application looks in the SCHEMA\IMG directory for files with the naming convention: DBWVisualCuesDefinition_*.txt
The available file suffixes are listed in the Options→User Options tab:

allowing the user to select the desired Visual Cues definition file.
Once selected, DBWorks will reload the Visual Cues definitions, so dynamically changing the current Visual Cues visualization.
Selecting OutOfStock, only the items that satisfies the DBWVisualCuesDef_OutOfStock.txt definitions will be displayed with a Visual Cue:

Selecting Recommended, only the items that satisfies the DBWVisualCuesDef_Recommended.txt definitions will be displayed with a Visual Cue:

The new position code 3 can be assigned to a Visual Cue, allowing the Visual Cue to be right-aligned. The <Tree Img Offset> and <Grid Img Offset> parameters must be negative.
;-------------------------------------------------------------- ; DBWVisualCuesDef.txt ; ; DBWorks Visual Cues Definition File ; ;-------------------------------------------------------------- ; "<field name>","<field value pattern>","<Image Definition>",<Img width>,<Position Code>,<Tree Img Offset>,<Grid Img Offset> ; ; <Image definition>::= ; a .BMP/.JPG/.TIF/.PCX/.TGA file name, or … ; @Line,<pen width>,R,G,B ; @Cross,<pen width>,R,G,B ; @Rectangle,<pen width>,R,G,B ; @Ellipse,<pen width>,R,G,B ; ; <Position Code> 0: full row; 1:icon; 2: text; 3: right-side full row ; "T","A","dbwscbar149.bmp",18,3,-24,-24

The new parameter @SILENT (value [0/1]) is passed to the OnGetWorkflowProcess.LST
The parameter is 1 when DBWorks requests to return the process without any user interaction.
The following is an example of the script OnWorkflowStateHasChanged.LST, adapted for sending a notification e-mail to all the users that have the EMAIL field not null in the DBWORKS_USERS table.
.VBSCRIPT
const temporaryZipAttachmentFileName = "C:\temp\attachment.zip"
sub main
DBWInit(TRUE)
silent = DBWInput("@SILENT")
ecoId = DBWInput("@ECO_ID")
process = DBWInput("@PROCESS")
fromState = DBWInput("@FROM_STATE")
toState = DBWInput("@TO_STATE")
docUid = DBWInput("@DOCUMENT_UNIQUE_ID")
allOk = DBWInput("@ALL_OK")
DBWShell("WorkflowGetNotesAndFileAttachment " & docUid )
notes = DBWResult("@WORKFLOW_NOTES")
attachment = DBWResult("@WORKFLOW_ATTACHMENT")
id = DBWQueryByUid( docUid, DBWLookUp("NAME_FIELD_ID") )
user = DBWGetOption("USER_NAME")
ReDim Preserve userList(1)
DBWorkflowGetUserList toState,userList
for j=0 to ubound(userList)-1 step 4
userId = userList(j)
fullName = userList(j+1)
phone = userList(j+2)
email = userList(j+3)
nameToAddress = userId & "@" & DBWGetOption("COMPANY_ID")
if DBWGetOption("DBWARM_USER") <> userId then
sendNotificationEmail nameToAddress,id,fromState,toState,user,attachment
end if
next
end sub
sub sendNotificationEmail( nameToAddress, id, fromState, toState, user, attachment )
SUBJECT = "Workflow notification: " & id & " - state changed to """ & toState & """"
BODY_HTML01 = "<html><body>"
BODY_HTML02 = "<h1 align=""center""><FONT face=""Verdana"" size=""5"">DBWorks Workflow Notification</FONT></h1>"
BODY_HTML03 = "</br>"
BODY_HTML04 = "Document"
BODY_HTML05 = "<h0 align=""center""><FONT face=""Arial black"" size=""3"">" & id & "</FONT></h0>"
BODY_HTML06 = "</br>"
BODY_HTML07 = "has changed state from"
BODY_HTML08 = "<h0 align=""center""><FONT face=""Arial black"" size=""3"">" & fromState & "</FONT></h0>"
BODY_HTML09 = "to"
BODY_HTML10 = "<h0 align=""center""><FONT face=""Arial black"" size=""3"">" & toState & "</FONT></h0>"
BODY_HTML11 = "</br>"
BODY_HTML12 = "</br>"
BODY_HTML13 = "Sent by " & user & ", " & Date() & "</br>"
BODY_HTML14 = "</br>"
BODY_HTML15 = "</body></html>"
if attachment<>"" then
DBWShell("FileZip New " & replace(temporaryZipAttachmentFileName," ","|"))
DBWShell("FileZip Add " & replace(attachment," ","|"))
DBWShell("FileZip Create")
ATTACHMENT01 = temporaryZipAttachmentFileName
end if
DBWShell("EMail New Notification " & nameToAddress )
DBWShell("EMail Data SUBJECT " & replace(SUBJECT," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML01," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML02," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML03," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML04," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML05," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML06," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML07," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML08," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML09," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML10," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML11," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML12," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML13," ","|"))
DBWShell("EMail Data BODY_HTML " & replace(BODY_HTML14," ","|"))
DBWShell("EMail Data ATTACHMENT " & replace(ATTACHMENT01," ","|"))
DBWShell("SendEMail")
end sub
DBWorks ADW 2007 introduces a support for duplicating a snapshot of the current status of an assembly. The assembly file names are generated with a time stamp and current revision info. The assembly snapshot can be registered in the database or attached to the original document with the new DBW_ATTACHMENTS managed by DBWorks.
A new page in the options defines the settings for the As-Built duplication.

When registering As-Built assemblys they will be located in the As_Built project (auto-created) under a sub-project named as the sub-assembly.

When registering As-Built assemblys as attachments they will be located in Attachments tab.

The custom query will now define the documents that MUST be converted.
A new option for defining the load on different workstations has been added .
When the option is set the Conversion Wizard will create a file with the a number of queries to be loaded on, as custom query ,on each workstation. The file will be opened in notepad after confirming the Conversion Wizard dialog.
This Wizard allows to import documents, properties and revisions from an existing PDMWorks for Worgroup installation.
The tool requires DBWorks StandAlone 2007 and a SolidWorks 2007 or better.
When you start the Wizard, you need to log into PDMWorks from within the wizard.
Then you must select the projects to import. If you have a large number of documents importing the projects in separate batches can be a good idea.
After selecting the project you are presented with the list of properties and configurations. Here you must select the properties you want to import and associate them with the fields of the DBWorks records. If needed you can create new fields to store the information coming from the custom properties of the files.
If you import the configurations (DBWorks will treat each configuration as a separate record) you can select a set of configurations to import or to ignore.
In the final tab you start the migration.
During the migration the files are first extracted to a selected path and grouped in sub folders, then registered one by one.
It is possibe to use both SolidWorks or DBWorks Stand Alone to register the files, but DBWorks Stand Alone is generally faster.
Linked Tables can be managed from DBCustomizer selecting the entry Customize, Linked Tables
The interface allows you to specify that a field in the DOCUMENT table is used as a key to link an external table as an extension of the DOCUMENT table:

How to add a link:
Automatic behaviors in the interface to simplify the task:

The scripts in the ExcelBOM.lib library had to be updated to include the new function
ExcelBOMRevision(uid, revision)
Another function has been added to avoid lack of generality:
Function ExcelBOM3(uid, par_file, excel_file_name,revision)
where the last parameter should be an empty string for the current revision and the revision for which the BOM is requested otherwise.
Also the function BOMRecordset in the object MWSCriptGui.BOM now has an added optional parameter for the revision name and it returns a recordset with the current BOM if the revision is a null string and the BOM for the requested revision otherwise. All changes are backwards compatible. Note that for previous revisions you cannot obtain information about the parents of the items, namely projects and drawings because such information would not be accurate.
ID FILE_NAME FILE_DIRECTORY DESCRIPTION
The usual editing rules for comments apply to this parameter file; there currently is no GUI editing tool for this file.
A new version of WebClient will be released shortly after the release of DBWorks/DBInventor 2007
Use Dataentr.LST ), when working with the configurations activated, for weldment parts, if the active configuration is the <As Welded>, DBWorks activates the parent <As Machined> configuration, for avoiding rename conflicts (generating SW errors) when the derived <As Welded> configuration is renamed before the <As Machined>T VARCHAR(1) ID VARCHAR(256) USERID VARCHAR(256) SERVER VARCHAR(256) DESCRIPTION VARCHAR(512) FILE_DIRECTORY VARCHAR(256) FILE_NAME VARCHAR(256) STATE VARCHAR(40) CONFIGURATION VARCHAR(256) REVISION VARCHAR(40) COMPANY_ID VARCHAR(256) OWNER_COMPANY_ID VARCHAR(256) CHECK_OUT_BY VARCHAR(256) UNIQUE_ID INTEGER
The BIN\DWGView.EXE is obsolete and it has been removed;
consequently, the RMB→Preview of …DWG functionality, uses now the new DWG viewer
Even if the option Open→
Don't open related documents on checkout is unchecked, any linked Generic Document is no more automatically opened by DBWorks
Always use Excel_BOM has been removed ( Excel_BOM is now always used )
Use OnViewXLS.LST script has been removed
Update Variant Notes on Revision approval
Update Drawings on revision approval
Automatic parent's bitmap refresh on revisions approval