Giter VIP home page Giter VIP logo

archicad-additional-json-commands's Introduction

Additional JSON/Python Commands Add-On for Archicad

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.

Implemented Commands

Publish

Performs a publish operation on the currently opened project. Only the given publisher set will be published.

Parameters

  • publisherSetName (required)
    • Type: string
    • The name of the publisher set.
  • outputPath
    • Type: string
    • Full local or LAN path for publishing. Optional, by default the path set in the settings of the publiser set will be used.

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

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)

GetProjectInfo

Retrieves the location of the currently running Archicad executable.

Parameters

Response

  • isUntitled (required)
    • Type: string
    • True, if the project is not saved yet.
  • isTeamwork (required)
    • Type: string
    • True, if the project is a Teamwork (BIMcloud) project.
  • projectLocation
    • Type: string
    • The location of the project in the filesystem or a BIMcloud project reference.
  • projectPath
    • Type: string
    • The path of the project. A filesystem path or a BIMcloud server relative path.
  • projectName
    • Type: string
    • The name of the project.

Python Example

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']

TeamworkReceive

Performs a receive operation on the currently opened Teamwork (BIMcloud) project.

Parameters

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

from archicad import ACConnection

conn = ACConnection.connect ()

acc = conn.commands
act = conn.types

acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'TeamworkReceive'))

GetArchicadLocation

Retrieves the location of the currently running Archicad executable.

Parameters

Response

  • archicadLocation (required)
    • Type: string
    • The location of the Archicad executable in the filesystem.

Python Example

from archicad import ACConnection

conn = ACConnection.connect ()

acc = conn.commands
act = conn.types

response = acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'GetArchicadLocation'))
archicadLocation = response['archicadLocation']

Quit

Performs a quit operation on the currently running Archicad instance.

Parameters

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

from archicad import ACConnection

conn = ACConnection.connect ()

acc = conn.commands
act = conn.types

acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'TeamworkReceive'))

ReloadLibraries

Reloads the libraries of the current Archicad project.

Parameters

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

from archicad import ACConnection

conn = ACConnection.connect ()

acc = conn.commands
act = conn.types

acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'ReloadLibraries'))

MoveElements

Moves elements with a given movement vector.

Parameters

  • elementsWithMoveVectors (required)
    • Type: array
    • Items:
      • Type: object
      • Fields:
        • elementId (required)
          • Type: Element identifier object (guid field)
        • moveVector (required)
          • Type: 3D vector object (x, y, z fields).

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

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})

CreateColumns

Creates columns. The given coordinates will be origos of the columns.

Parameters

  • coordinates (required)
    • Type: array of 3D coordinates with x,y,z values

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

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})

CreateSlabs

Creates polygonal slabs. The given coordinates will define the polygon of the edges.

Parameters

  • slabs (required)
    • Type: object
    • Fields:
      • level (required)
        • Type: number
        • The elevation of the slab, the Z coordinate of the reference line.
      • polygonCoordinates (required)
        • Type: array of 2D coordinates with x,y values.
      • holes (optional)
        • polygonCoordinates (optional)
          • Type: array of 2D coordinates with x,y values.

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

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})

GetHotlinks

Get the file system locations (path) of the hotlink modules. The hotlinks can have tree hierarchy in the project.

Response

  • hotlinks (required)
    • Type: array
    • List of hotlinks with locations and the children in the tree hierarchy.

Python Example

from archicad import ACConnection

conn = ACConnection.connect ()

acc = conn.commands
act = conn.types

print (acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'GetHotlinks')))

GetGDLParametersOfElements

Get all the GDL parameters (name, type, value) of the given elements.

Parameters

  • elements (required)
    • Type: array
    • Items:
      • Type: object
      • Fields:
        • elementId (required)
          • Type: Element identifier object (guid field)

Response

  • gdlParametersOfElements (required)
    • Type: array of GDL parameters dictionary.

Python Example

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 })))

ChangeGDLParametersOfElements

Changes the given GDL parameters of the given elements.

Parameters

  • elementsWithGDLParameters (required)
    • Type: array
    • Items:
      • Type: object
      • Fields:
        • elementId (required)
          • Type: Element identifier object (guid field)
        • gdlParameters (required)
          • Type: The dictionary of GDL parameters with the new values.

Response

  • errorMessage
    • Type: string
    • The error message upon error. If the command executed successfully, then there is no response.

Python Example

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 })))

archicad-additional-json-commands's People

Contributors

dushyant-basson avatar tlorantfy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

archicad-additional-json-commands's Issues

AC27 version

Could you upgrade the apx to be used with AC v27
thnx

AC26 Build

Would be great to get a compiled APX for AC26 for this.

Thanks,
Scott

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.