Welcome to adamspy’s documentation!¶
adamspy is a python package designed for CAE analysts who use Adams to automate manipulation of files and data outside of the Adams environment [1] . This project is currently heavily focused on automation of tasks involving Adams Drill. Eventually the project should be expanded to other Adams tools.
Todo
Document aviewpy and link to it here.
Getting Started¶
Requirements¶
- Python 3.6
- Adams View (2018 or later)
- Adams Drill (required to use the adamspy.adripy module)
Setting Environment variables¶
Before importing adamspy into your python script you need to set some environment variables to allow adamspy to communicate with your adams installation. Here are the the environment variables you need to set.
Variable | Value |
---|---|
ADRILL_USER_CFG | Full path to the user adrill cfg file (e.g. C:\users\user_name.adrill.cfg) |
ADRILL_SHARED_CFG | Full path to the shared adrill cfg file (e.g. C:\MSC.Software\Adams\2018\adrill\adrill.cfg) |
ADAMS_LAUNCH_COMMAND | Full path to the adams launch command (e.g. C:\MSC.Software\Adams\2018\common\mdi.bat) |
If you don’t know how to set environment variables you can
set them directly in your python script using os.environ
as follows:
import os
os.environ['ADRILL_USER_CFG'] = 'C:\\users\\user_name\\.adrill.cfg'
os.environ['ADRILL_SHARED_CFG'] = 'C:\\MSC.Software\\Adams\\2018\\adrill\\adrill.cfg'
os.environ['ADAMS_LAUNCH_COMMAND'] = 'C:\\MSC.Software\\Adams\\2018\\common\\mdi.bat'
Note: The values above are just for example. Make sure you use the correct paths for your Adams installation.
Usage¶
Once your enivronment variables are set you can import and use the adamspy package. Here is an example script:
#! python3
# Set Environment Variables
import os
os.environ['ADRILL_USER_CFG'] = 'C:\\users\\user_name\\.adrill.cfg'
os.environ['ADRILL_SHARED_CFG'] = 'C:\\MSC.Software\\Adams\\2018\\adrill\\adrill.cfg'
os.environ['ADAMS_LAUNCH_COMMAND'] = 'C:\\MSC.Software\\Adams\\2018\\common\\mdi.bat'
# Import the adripy module from the adamspy package
from adamspy import adripy
# Get the length of a bha (not including upper physical and
# equivalent drill pipe) defined in my_string.str
string_file = 'my_string.str'
bha_length = adripy.get_bha_length(string_file)
# print the bha length to the terminal
print(f'The length of this BHA is {bha_length} feet.')
The above script would output:
> The length of this BHA is 856.88 feet.
Next Steps¶
If you aren’t sure how to use this package, you can start by examining the adripy examples.
You can also examine the functions in the
utilities
. These are
basic functions for working with Adams Drill data.
From there you should explore the DrillString
class
, the DrillEvent
class, the DrillSolverSettings
class, and the DrillTool
class.
These classes represent Adams Drill objects (e.g. drill strings, events, pdc bits) and have methods for building and running drill models.
Contribute¶
- Source Code: https://github.com/bthornton191/adamspy
Indices and tables¶
Footnotes
[1] | adamspy is designed to run in a stand alone python environment. It must communicate with an Adams installation, but need not run in the Adams View environment. However, the package should work if run in the Adams View python environment. See aviewpy for tools that are specifically meant for the Adams View environment. |