The below Sample Script demonstrates how a user might Size all Zones and Joints within a selected Project. It is contained in a Run method, which makes it compatible with the Script Runner and provides the Script a Database and active Project.
Note
The below methods have optional parameters (not provided in the example), which take in specific collections of Joints or Zones, as opposed to Sizing all Zones and/or Joints in the entire Project.
import hyperx as hx
def Run(database_):
# Wrap database coming from Script Runner in
# Python API wrapper, to make interacting with API easier
database = hx.Application(database_)
project = database.ActiveProject
# Size joints
jointSizingResults = project.SizeJoints()
jointSizingSuccessful = jointSizingResults.Success
jointSizingMessage = jointSizingResults.Message
if jointSizingSuccessful:
print('Joint sizing successful')
else:
print(f'Joint sizing not successful. Additional information: \n{jointSizingMessage}')
# Size zones
zoneSizingResults = project.SizeZones()
zoneSizingSuccessful = zoneSizingResults.Success
zoneSizingMessage = zoneSizingResults.Message
if zoneSizingSuccessful:
print('Zone sizing successful')
else:
print(f'Zone sizing not successful. Additional information: \n{zoneSizingMessage}')