8pt to 12pt

In this post I will show you how to change the default font-size from 8pt to 12pt for the legend/title/state- block in the Abaqus/Viewer. Then outline how you can use it do change other default behaviors.

Step 1: Find and backup the environment file

The file is specifically named “abaqus_v6.env” and is located in the “SMA/Site” folder of your installation. For me, the complete path is “C:SIMULIAAbaqus6.13-2SMAsiteabaqus_v6.env”
When you have located this file, make a copy of it – better safe than sorry, right?

Step 2: Edit the environment file

Open the environment file in a text-editor of you choosing. Notepad will do just fine!
Towards the end of this file, locate the function called “def onCaeStartup():“, edit the text so it looks like:

def onCaeStartup():

	# we need to import methodcallback functionallity
    import methodCallback

	# set default font to 12pt for current viewport
	def odbPreferences(callingObject, pargs, kwards, userData):
		# get the current viewport
        vp = session.viewports[session.currentViewportName]
        vp.viewportAnnotationOptions.setValues(
        legendFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*',
        titleFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*',
        stateFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*')

	# each time an odb is opend, change font size for current viewport
	methodCallback.addCallback(ALL_TYPES, 'openOdb', odbPreferences, callAfter=True)

NB: Make sure that the text is indented correctly, i.e that the spaces are copied correctly!

After you have edited your environment file,  restart the Abaqus/CAE to get the effect of these changes – and there you go – the new default text for the legend/title/state- block has a 12pt font-size!

How it works

In the environment file we can specify a series parameters (as documented in the Abaqus Installation and Licensing Guide, chapter 4- in the documentation) and create python functions and callbacks. This is the file that contains the address to your license server. The function “onCaeStartup():” is run at each time Abaqus/CAE is started, so we can use this function to change default behavior at start-up. We have defined created the function “odbPreferences(….)” that detects the currently active viewport and set the default font-sizes to 12pt. Outside the function, we have a methodCallback that executes our “odbPreferences” each time the Abaqus/CAE calls “openOdb”. Pretty neat!

Personally I prefer to have the averaging threshold set to 20% and hide the compass:

def onCaeStartup():

    import methodCallback

	# set default font to 12pt for current viewport
	def odbPreferences(callingObject, pargs, kwards, userData):
		# get the current viewport
        vp = session.viewports[session.currentViewportName]
        vp.viewportAnnotationOptions.setValues(
        legendFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*',
        titleFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*',
        stateFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*')
        vp.viewportAnnotationOptions.setValues(compass = False)
        vp.odbDisplay.basicOptions.setValues(averagingThreshold=20)

	# each time an odb is opend, change font size for current viewport
	methodCallback.addCallback(ALL_TYPES, 'openOdb', odbPreferences, callAfter=True)

You can easily apply other customizations by creating other methodCallbacks, or just by applying new values to the default viewport object. 
Changes done in a Abaqus/CAE session is always written to the replay file (.rpy) as python code.