-
Notifications
You must be signed in to change notification settings - Fork 26
Api Examples
Alex Miarsky edited this page Feb 11, 2020
·
4 revisions
from pprint import pprint
from thlib.environment import dl, tc, gf, cfg_controls, env_inst, env_mode, env_tactic, env_server, env_write_config, env_read_config
tc = tc()
gf = gf()
env_inst.set_current_project('dolly3d')
server = tc.server_start(project='dolly3d')
# Getting sobjects through tactic api
sobjects_api = server.eval(u"@SOBJECT(sthpw/file)", single=True)
#pprint(sobjects_api)
# Getting sobjects through tactic api wrapper
stype = server.build_search_type('dolly3d/assets', 'dolly3d')
sobjects_objects, info = tc.get_sobjects(stype, [('name', 'EQI', 'dolly')])
sobject = sobjects_objects.values()[0]
print(sobject.get_info()) # Getting dict with info
print(sobject.get_files_sobjects()) # Getting all files related to Sobject
print(sobject.get_snapshots_sobjects()) # Getting all snapshots related to Sobject
print(sobject.get_notes()) # Getting all notes related to Sobject
print(sobject.get_stype()) # Getting search type object. Refer to SType class
print(sobject.get_project()) # Getting Porject class object
stype = sobject.get_stype()
parent_stypes = stype.get_parent_stypes()
parent_stypes[0].get_code()
print(sobject.get_related_sobjects(parent_stype=parent_stypes[0])) # Getting all related to sobject sobjects
print(dir(sobject)) # dir all useful methods