2021-02-07 02:56 PM - last edited on 2021-09-14 09:59 AM by Noemi Balogh
2021-02-13 09:58 AM
import json import urllib2 guid = json.dumps(classSysGuid) if run: req = urllib2.Request('http://localhost:19723') response = urllib2.urlopen(req,json.dumps({"command": "API.GetAllClassificationsInSystem","parameters":json.loads(guid)}).encode("UTF-8")) response = json.loads(response.read()) classIds = [] if response['succeeded']: for item in response['result']['classificationItems']: for key,dict in item['classificationItem'].items(): if key == 'classificationItemId': classIds.append({'classificationItemId':dict}) guids = json.dumps(classIds) req = urllib2.Request('http://localhost:19723') response = urllib2.urlopen(req,json.dumps({ "command":"API.GetDetailsOfClassificationItems", "parameters":{ "classificationItemIds":json.loads(guids) } }).encode('UTF-8')) response = json.loads(response.read()) id = [] name = [] description = [] for item in response['result']['classificationItems']: id.append(item['classificationItem']['id']) name.append(item['classificationItem']['name']) description.append(item['classificationItem']['description'])Also sharing the GH file. Note that there is a dependency to a 3rd. party plugin (Human), but Its not necessary for the json logic to work, just used as a convenient UI gadget to select between different classification systems received from Archicad document. There is alternative implemented in the shared gh if you don't want to install Human in your system.
2021-02-13 02:30 PM
2021-02-14 07:45 PM
#import rhinoscriptsyntax as rs import json import urllib2 as rb #request = rb.Request('http://localhost:19723') request = 'http://localhost:19723' response = rb.urlopen(request,json.dumps({"command":"API.GetAllClassificationSystems"}).encode('UTF-8')) results = json.loads(response.read()) result = results['result']['classificationSystems'][1]['classificationSystemId']['guid'] response.close() response = rb.urlopen(request,json.dumps({"command":"API.GetAllClassificationsInSystem", "parameters": {"classificationSystemId": {"guid": result }}}).encode('UTF-8')) results = json.loads(response.read()) response.close() seed =results['result']['classificationItems'] output = [] level = 0 def get_ids(seed,kids = 0 ): global level level += 1 for item in seed: output.append( ' '*(level-1) + item['classificationItem']['id']) if kids >0: kids -= 1 if 'children' in item['classificationItem'].keys(): depth = len(item['classificationItem']['children']) get_ids(item['classificationItem']['children'], kids = depth) else: if kids == 0: pass # Debug only level -= 1 get_ids(seed, kids = 0 ) for x in output: print(x)
2021-02-15 11:06 AM
Also don't see a need for the double conversion of JSON commandscool, much better!
2021-02-17 05:01 PM
2021-02-18 06:54 AM
2021-02-18 05:29 PM
poco2013 wrote:I am afraid that your assumption is reflecting pretty well what many users already having in their minds ...
Graphisoft's management has already reneged on several promised developments. I do wonder if the small increments and diverse approach is just marketing hype to to tout features that really have little real world utilization because of the limited development effort. In effect, false advertising?
The approach of "lets do a little of everything" will not work and never has. It only promotes features that can not be practically used.This is ultimately going to frustrate users and give Archicad a very bad reputation if some change in philosophy is not demonstrated soon.
2021-02-22 11:45 AM
I mostly agree but getting there is the real problem in my opinion. With the introduction of Python, Param-o ,Grasshopper, MEP, Structural connections, etc., etc. I expect that Graphisoft has taken on more than they can deliver. Small yearly incremental changes in each of these areas will be of no use to anyone. For example, the Present C++ API has approx. 900 functions, The present Python API has 25. At this rate, it would be 50 years before Python would approximate the utility of the C API. and the same is true for the other features.Yes, as JSN said this is a shared "fear". Graphisoft seems to follow the same pattern, again and again, letting perish lots of great initiatives, but feel bored complaining about all this. The general user complacency, the minimal near to zero contact with ArchiCAD developers... makes the conversation not only boring (because its futility), but also discouraging because one finishes feeling like an annoying troll.
With respect to Python, Graphisoft's management has already reneged on several promised developments. I do wonder if the small increments and diverse approach is just marketing hype to to tout features that really have little real-world utilization because of the limited development effort. In effect, false advertising?