This Add-On extends the JSON interface of Archicad by implementing new JSON commands.
These JSON commands are callable via Python, see examples below.
Download the Add-On or build it for your own platform and Archicad version.
Requires Archicad 25 or later.
Performs a publish operation on the currently opened project. Only the given publisher set will be published.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
publisherSetNames = acc.GetPublisherSetNames ()
for publisherSetName in publisherSetNames:
parameters = { 'publisherSetName': publisherSetName }
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'Publish'), parameters)
Retrieves the location of the currently running Archicad executable.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
response = acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'GetProjectInfo'))
isTeamwork = response['isTeamwork']
if not response['isUntitled']:
projectLocation = response['projectLocation']
Performs a receive operation on the currently opened Teamwork (BIMcloud) project.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'TeamworkReceive'))
Retrieves the location of the currently running Archicad executable.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
response = acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'GetArchicadLocation'))
archicadLocation = response['archicadLocation']
Performs a quit operation on the currently running Archicad instance.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'TeamworkReceive'))
Reloads the libraries of the current Archicad project.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'ReloadLibraries'))
Moves elements with a given movement vector.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
objects = acc.GetElementsByType ('Object')
elementsWithMoveVectors = [{'elementId': {'guid': str (object.elementId.guid)}, 'moveVector': {'x': 1.0, 'y': 1.0, 'z': 0.0}} for object in objects]
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'MoveElements'), {'elementsWithMoveVectors': elementsWithMoveVectors})
Creates columns. The given coordinates will be origos of the columns.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
storyHeight = 3.0
origosOfNewColumns = [{'x': x*2, 'y': y*2, 'z': z*storyHeight} for x in range(10) for y in range(10) for z in range(2)]
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'CreateColumns'), {'coordinates': origosOfNewColumns})
Creates polygonal slabs. The given coordinates will define the polygon of the edges.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
origo = {'x': 0, 'y': 0, 'z': 0}
slabWidth = 6.0
slabHoleWidth = 2.0
storyHeight = 3.0
slabPolygonCoordinates = [
{'x': +3.0, 'y': -3.0},
{'x': +3.0, 'y': +3.0},
{'x': -3.0, 'y': +3.0},
{'x': -3.0, 'y': -3.0}
]
slabHolePolygonCoordinates = [
{'x': +1.0, 'y': -1.0},
{'x': +1.0, 'y': +1.0},
{'x': -1.0, 'y': +1.0},
{'x': -1.0, 'y': -1.0}
]
slabs = [{
'level': i * storyHeight,
'polygonCoordinates': slabPolygonCoordinates,
'holes': [{'polygonCoordinates': slabHolePolygonCoordinates}]
} for i in range(3)]
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'CreateSlabs'), {'slabs': slabs})
Creates library part based objects. The given coordinate will be the origo of the object.
treeParameters = [{'name': 'Tree Model Detailed 26',
'coordinate': {'x': 0, 'y': 0, 'z': 0},
'dimensions': {'x': 2, 'y': 2, 'z': 10}}]
acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'CreateObjects'), {'objects': treeParameters})
Get the file system locations (path) of the hotlink modules. The hotlinks can have tree hierarchy in the project.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
print (acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'GetHotlinks')))
Get all the GDL parameters (name, type, value) of the given elements.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
elements = [ { 'elementId' : { 'guid' : str (e.elementId.guid) } } for e in acc.GetElementsByType ('Object') ]
print (acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'GetGDLParametersOfElements', { 'elements' : elements })))
Changes the given GDL parameters of the given elements.
from archicad import ACConnection
conn = ACConnection.connect ()
acc = conn.commands
act = conn.types
elementsWithGDLParameters = [ { 'elementId' : { 'guid' : str (e.elementId.guid) }, 'gdlParameters' : { 'gs_cont_pen' : 95 } } for e in acc.GetElementsByType ('Object') ]
print (acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'ChangeGDLParametersOfElements', { 'elementsWithGDLParameters' : elementsWithGDLParameters })))