Customizing the startup scripts in Adams View can significantly enhance your workflow. By tailoring these scripts to your specific needs, you can streamline repetitive tasks, automate complex processes, and create a more efficient and personalized interface. In this post, I’ll show you step-by-step how to create and implement startup scripts to customize Adams View to your liking. Whether you’re looking to modify the user interface, set defaults, or automate routine operations, these scripts will empower you to make Adams View work exactly the way you want it to.

Create a directory for custom startup files

The first step is to create a new directory for storing custom startup files. I’ll refer to this as aview_startup_files.

Modify aview.pth

After that you’ll need to find and edit your aview.pth file. This is located in the <install_dir>/aview directory (e.g. C:\MSC.Software\Adams\2023\aview). This file tells Adams View where to look and in what order for certain files. We want to change where Adams View looks for command (.cmd) files.

The default aview.pth file contains a bunch of lines referencing example directories which are unnecessary unless you are working through training examples. You can delete all of these lines if you wish.

Find the lines for .cmd. They should look like so

.cmd $aview_dir/
.cmd $HOME/

Replace $aview_dir with the path to your aview_startup_files. So you should now have:

.cmd C:/path/to/aview_startup_files/
.cmd $aview_dir/
.cmd $HOME/

Replace the path in the first line with the path to your new aview_startup_files directory. Now Adams View will look for command files in the following order:

  1. In the current working directory (this is implicit)
  2. In the aview_startup_files directory
  3. In the user’s home directory

Create a custom aviewBS.cmd

Now we can create modified adams view startup files and place them in the new aview_startup_filesdirectory. There are three different startup scripts that run when Adams View starts:

  1. aviewBS.cmd - Before Start
  2. aview.cmd
  3. aviewAS.cmd - After Start

We are going to use the aviewBS.cmd file to make our customizations. This frees up the other two for project-specific customizations. Start by creating a new file called aviewBS.cmd in your new aview_startup_files directory that you created above. This will override the aviewBS.cmd file that you may have in your %USERPROFILE% if you have saved settings from Adams View. I recommend you either copy the contents of the existing %USERPROFILE%\aviewBS.cmd file to your new file or include the following lines:

! ---------------------------------------------------------------------
! Load user aviewBS.cmd
! ---------------------------------------------------------------------
if condition=(eval(file_exists(getenv("MSC_ADAMS_STARTIN_DIR") // "\\aviewBS.cmd")))
	file command read file_name=(eval(getenv("MSC_ADAMS_STARTIN_DIR") // "\\aviewBS.cmd"))
end

Now you can add your customizations to the aviewBS.cmd file. Here’s a simple example, or you can check out my customizations for more inspiration!

! Hide buttons I don't use
int push_button undisplay push_button_name = .gui.main.standard_toolbar.view_fit 
int push_button undisplay push_button_name = .gui.main.standard_toolbar.zoom_box 
int push_button undisplay push_button_name = .gui.main.standard_toolbar.view_center 
int btn_stack undisplay btn_stack_name = .gui.main.standard_toolbar.dyn_view_tra_ro 
int btn_stack undisplay btn_stack_name = .gui.main.standard_toolbar.dyn_tra_depth 
int push_button undisplay push_button_name = .gui.main.standard_toolbar.view_zoom 
int field display field_name = .gui.main.standard_toolbar.*


! See https://github.com/bthornton191/adams_vscode/issues/6#issuecomment-2192053891
var set var=.mdi.tmp_int int=(eval(run_python_code("import threading"))) 

! ---------------------------------------------------------------------
! Load user aviewBS.cmd
! ---------------------------------------------------------------------
if condition=(eval(file_exists(getenv("MSC_ADAMS_STARTIN_DIR") // "\\aviewBS.cmd")))
	file command read file_name=(eval(getenv("MSC_ADAMS_STARTIN_DIR") // "\\aviewBS.cmd"))
end

Migrate the default aviewAS.cmd file (Optional)

I personally hate the splash screen that comes up when you start Adams View. If you’ve followed the steps above, you won’t see it anymore 🙌. If you decide you want it back you’ll find it in <install_dir>\aview\aviewAS.cmd (the default startup script). This file no longer runs since you overwrote the .cmd $aview_dir/ line in aview.pth. If you want the splash screen back, you can copy the aviewAS.cmd file to your aview_startup_files directory or you can add the contents to on of the other startup files.

Conclusion

Customizing your Adams View startup scripts can greatly enhance your workflow by tailoring the interface to your specific needs. By following the steps outlined in this guide, you can disable the splash screen, hide unused buttons, and add other customizations to streamline your experience. Don’t forget to explore additional customization options and share your own tips and tricks with the community. Check back soon for more advanced customization tips and feel free to reach out if you have any questions or feedback.