Design forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Grasshopper + Python json Addon

greg_lupo
Newcomer
Is it possible to write custom GH python nodes that could use archicad module?
GH works on Ironpython 2.7.5 and 'archicad' python module works on python 3.7.
Any ideas how to combine it?
5 REPLIES 5

runxel
Mentor
I believe this is possible.
You basically need to skip the official Python package and just do it "by hand".
First result on google on the Rhino forum.
See also the JSON interface docs.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

JSN
Booster
Has anybody made some progress with it so far, or can tell if it's worth the effort to try it out?

leceta
Booster
I made a quick test a while ago, it worked fine. It's a json api call made from GH python component. As I dont have much time to work on this topic (and time goes on), let me share the piece of code with you. It just collect guid data for Archicad document (pretty dumb, don't expect anything fancy) but hopefully will guide someone on further developing useful logic. In theory this gives access to every function exposed in the JSON API from grasshopper (primarily attributes, drawing and views programmatical gets/sets)
__author__ = "leceta"
__version__ = "2020.03.27"

import json
import urllib2
if run:
    req = urllib2.Request('http://localhost:19723')
    response = urllib2.urlopen(req,json.dumps({"command":"API.GetAllElements"}).encode("UTF-8"))
    result = json.loads(response.read())
    id = []
    for element in result['result']['elements']:
        id.append(element['elementId']['guid'])
    result = [response]

JSN
Booster
Thx, that looks promising, however it givs me an url error.


Might be related to our IT restrictions but actually it should work ... any ideas?

EDIT: OK, seems to only work when AC is not in Admin Mode while Rhino has to be running as admin.

leceta
Booster
also of interest the next thread
https://archicad-talk.graphisoft.com/viewtopic.php?f=23&t=71977

Didn't find the answer? Start a new discussion

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!