Files and resource library#

DAVE is designed such that it can be used as part of a larger system in an organization. In such a system various sources for assets and resources may exist: For example a shared library with officially approved assets, a library with project assets that are still under construction, a personal folder with the items you are working on at that moment.

In a typical workflow an asset would first be created in a local or project folder. Then it would be checked and approved. Once approved it would be moved to an official (write protected) folder from where everyone with access should be able to easily use it.

Implementation#

DAVE nodes can load files. Files are used for:

  • Components (.dave files)

  • Visuals (.obj files and .blend files)

  • Buoyancy shapes (.stl / .obj files)

  • Tank shapes (.stl / .obj files)

  • Contact meshes (.stl / .obj files)

  • Standard nodes (.csv files)

  • Hydrodynamic databases (.hyd, .dhyd)

The content of these files is not stored in the DAVE model itself, they are read when the model is loaded or when the node is updated. The DAVE model only stores the location and name of the file it needs to read.

The name and location of the file (“resource”) can be provided to DAVE using the full path of the file. For example: c:\users\yourname\model.dave . While this will work fine for you, it will give issues when sharing your model with somebody else. Therefore DAVE provides the following options to point to a file in a “standard location”

Tip

res: model.dave Add res: in front of a filename to locate the file in the “resource” system cd: model.dave Add cd: in front of a filename to read the file from the “current directory”

The Scene object will not walk through sub-folders when looking for an asset or resource. This means that subfolders add to the uniqueness of the filename. A file called res: attempt1/box.obj is different from a file res: attempt2/box.obj

Standard Resources#

Some default resources are included with DAVE. These include basic geometric shapes, shackles and the famous DAVE fleet. You can add your own.

Resource system storage locations (res:)#

A Scene contains a list of locations where assets and resources can be found.

In the GUI this list can be seen and extended using file > settings

image-20230413084256094

Additional asset paths are stored for the current user of the computer. They are not part of the .DAVE model.

The standard resource paths (on top) can not be changed in the GUI.

The order of the list is important. The list is considered to be ordered from most-official to least-official. So, for the default list, a resource in the resources subfolder of the DAVE installation is considered of higher rank than a resource with the same name in the users DAVE_assets folder.

Attention

If a file with the same name exists in more than one resource location, then the location highest on the list is used.

For example res: cube.obj will always load cube.obj from the build-in resources folder as that is highest on the list and a file cube.obj is present there.

Stand-alone copy#

Sometimes is it needed to create a stand-alone copy of a model including all its dependencies. Examples are when sharing the model with somebody outside the organization or storing a copy for QC requirements.

The GUI provides an option to export the current model as a stand-alone copy. This is a .zip file containing the model and all its assets.

Scripting#

The resources are handled by a DaveResourceProvider object which is present in every scene.

By default its paths are initialized (in settings.py) to

  1. the resources subdirectory in the DAVE python source folder

  2. the DAVE_models subdirectory in the users home folder.

Attention

In custom builds of DAVE more or other default paths may have been added. A typical one is:

  1. c:\data\DAVE

You are free to add more locations or remove existing locations by either changing the initilization in settings.py for a system-wide change or by using the addPath method of the resource provider object.

s.resource_provider.addPath(....)

See also: Scene

Summary#

  • res: means look-up a file with this name in the resource folders

  • cd: means use the file from the current directory

  • s.resource_provider is an object taking care of the resource tracking. It contains a list of search paths.

  • This list can be viewed and extended via the gui at file > settings

  • This list is ordered from Most official to Least official

  • If a file with the same name exists in a more official location, then that file gets priority above a file with the same name in a less official location.