diff --git a/archicad-addon/.gitignore b/archicad-addon/.gitignore index 2ff4558..df8670b 100644 --- a/archicad-addon/.gitignore +++ b/archicad-addon/.gitignore @@ -1,3 +1,5 @@ Build/* +Test/TestProject* +!Test/TestProject.pla .DS_Store .vscode \ No newline at end of file diff --git a/archicad-addon/Examples/aclib/__init__.py b/archicad-addon/Examples/aclib/__init__.py index 65f24f6..1de145d 100644 --- a/archicad-addon/Examples/aclib/__init__.py +++ b/archicad-addon/Examples/aclib/__init__.py @@ -13,16 +13,23 @@ def RunCommand (command, parameters): 'parameters': parameters } request_string = json.dumps (request_data).encode ('utf8') - + response_data = urllib.request.urlopen (connection_object, request_string) response_json = json.loads (response_data.read()) - - if not response_json['succeeded']: + + if 'error' in response_json: + print ('Error:\n{}'.format (JsonDumpDictionary (response_json['error']))) + + if 'succeeded' not in response_json or 'result' not in response_json: return None - - return response_json['result'] -def RunTapirCommand (command, parameters): + return response_json['result'] if response_json['succeeded'] else None + +def RunTapirCommand (command, parameters, debug = True): + if debug: + print ('Command: ' + command) + print ('Parameters:\n' + JsonDumpDictionary (parameters)) + commandResult = RunCommand ('API.ExecuteAddOnCommand', { 'addOnCommandId': { 'commandNamespace': 'TapirCommand', @@ -30,6 +37,15 @@ def RunTapirCommand (command, parameters): }, 'addOnCommandParameters': parameters }) - if commandResult == None: - return None - return commandResult['addOnCommandResponse'] + + result = None if commandResult == None else commandResult['addOnCommandResponse'] + if debug: + print ('Response:\n' + JsonDumpDictionary (result)) + + if 'error' in result: + print ('Error:\n{}'.format (JsonDumpDictionary (result['error']))) + + return result + +def JsonDumpDictionary (d): + return json.dumps (d, indent = 4) \ No newline at end of file diff --git a/archicad-addon/Examples/change_gdlparameters.py b/archicad-addon/Examples/change_gdlparameters.py index bb672ef..0ecf7c0 100644 --- a/archicad-addon/Examples/change_gdlparameters.py +++ b/archicad-addon/Examples/change_gdlparameters.py @@ -3,16 +3,14 @@ gdlParameterName = 'gs_cont_pen' newValue = 95 -getElementsResponse = aclib.RunCommand ('GetElementsByType ', { "elementType": "Object" }) +getElementsResponse = aclib.RunCommand ('API.GetElementsByType', { 'elementType': 'Object' }) gdlParametersResponse = aclib.RunTapirCommand ('GetGDLParametersOfElements', getElementsResponse) elements = getElementsResponse['elements'] changedGDLParameters = [] for i in range(len(elements)): - print ('GDL Parameters of ' + elements[i]['elementId']['guid']) for name, details in gdlParametersResponse['gdlParametersOfElements'][i].items (): - print ('\t' + name + ' = ' + str (details['value'])) - if 'name' == gdlParameterName: + if name == gdlParameterName: details['value'] = newValue changedGDLParameters.append({ 'elementId' : elements[i]['elementId'], @@ -21,8 +19,4 @@ aclib.RunTapirCommand ('SetGDLParametersOfElements', { 'elementsWithGDLParameters' : changedGDLParameters }) -gdlParametersResponse = aclib.RunTapirCommand ('GetGDLParametersOfElements', getElementsResponse) -for i in range(len(elements)): - elementGuid = str (elements[i]['elementId']['guid']) - parameters = gdlParametersResponse['gdlParametersOfElements'][i] - print ('gs_cont_pen of ' + elementGuid + ' after the change: ' + parameters['gs_cont_pen']['value']) \ No newline at end of file +gdlParametersResponse = aclib.RunTapirCommand ('GetGDLParametersOfElements', getElementsResponse) \ No newline at end of file diff --git a/archicad-addon/Examples/create_building_materials.py b/archicad-addon/Examples/create_building_materials.py index 74c1351..274ba61 100644 --- a/archicad-addon/Examples/create_building_materials.py +++ b/archicad-addon/Examples/create_building_materials.py @@ -1,9 +1,6 @@ -import json import aclib -buildMats = [] -for i in range (1, 51): - buildMats.append ({ +buildMats = [{ 'name' : 'New Building Material ' + str (i), 'id' : str (i), 'manufacturer' : 'Tapir', @@ -18,17 +15,15 @@ 'heatCapacity' : 3.0, 'embodiedEnergy' : 4.0, 'embodiedCarbon' : 5.0 - }) + } for i in range (1, 11)] result = aclib.RunTapirCommand ('CreateBuildingMaterials', { 'buildingMaterialDataArray' : buildMats, 'overwriteExisting' : True }) -print (result) - result = aclib.RunCommand ('API.GetBuildingMaterialAttributes', { 'attributeIds' : result['attributeIds'] }) -print (result) +print ('New building materials:\n' + aclib.JsonDumpDictionary (result)) \ No newline at end of file diff --git a/archicad-addon/Examples/create_composites.py b/archicad-addon/Examples/create_composites.py index 6ba44cc..dde4a0b 100644 --- a/archicad-addon/Examples/create_composites.py +++ b/archicad-addon/Examples/create_composites.py @@ -6,8 +6,7 @@ lineTypes = aclib.RunCommand ('API.GetAttributesByType', { 'attributeType' : 'Line' }) lineTypeIds = lineTypes['attributeIds'] -composites = [] -composites.append ({ +newComposite = { 'name' : 'New Composite', 'useWith' : ['Wall', 'Shell'], 'skins' : [ @@ -48,15 +47,15 @@ 'linePen' : 4 } ] -}) +} -print ({ - 'compositeDataArray' : composites, - 'overwriteExisting' : True -}) result = aclib.RunTapirCommand ('CreateComposites', { - 'compositeDataArray' : composites, + 'compositeDataArray' : [newComposite], 'overwriteExisting' : True }) -print (result) +result = aclib.RunCommand ('API.GetCompositeAttributes', { + 'attributeIds' : result['attributeIds'] +}) + +print ('New composite:\n' + aclib.JsonDumpDictionary (result)) \ No newline at end of file diff --git a/archicad-addon/Examples/filter_elements.py b/archicad-addon/Examples/filter_elements.py index cb8546d..41801cb 100644 --- a/archicad-addon/Examples/filter_elements.py +++ b/archicad-addon/Examples/filter_elements.py @@ -1,19 +1,41 @@ import aclib +import itertools +print ('-' * 30) allElements = aclib.RunCommand ('API.GetAllElements', {})['elements'] -print ('All elements: {}'.format (len (allElements))) +print ('All elements = {}'.format (len (allElements))) +print ('-' * 30) -for flag in ['IsEditable', - 'IsVisibleByLayer', - 'IsVisibleByRenovation', - 'IsVisibleByStructureDisplay', - 'IsVisibleIn3D', - 'OnActualFloor', - 'OnActualLayout', - 'InMyWorkspace', - 'IsIndependent', - 'InCroppedView', - 'HasAccessRight', - 'IsOverriddenByRenovation']: - response = aclib.RunTapirCommand ('FilterElements', { 'elements': allElements, 'filters': [flag] }) - print ('{} {}'.format (flag, len (response['filteredElements']))) \ No newline at end of file +typesOfElements = aclib.RunCommand ('API.GetTypesOfElements', {'elements':allElements})['typesOfElements'] +typeCounterDict = dict() +for typeOfElement in typesOfElements: + if 'typeOfElement' in typeOfElement and 'elementType' in typeOfElement['typeOfElement']: + elementType = typeOfElement['typeOfElement']['elementType'] + if elementType not in typeCounterDict: + typeCounterDict[elementType] = 1 + else: + typeCounterDict[elementType] += 1 +for t,c in typeCounterDict.items (): + print ('{} = {}'.format (t, c)) +print ('-' * 30) + +flags = [ + 'IsEditable', + 'IsVisibleByLayer', + 'IsVisibleByRenovation', + 'IsVisibleByStructureDisplay', + 'IsVisibleIn3D', + 'OnActualFloor', + 'OnActualLayout', + 'InMyWorkspace', + 'IsIndependent', + 'InCroppedView', + 'HasAccessRight', + 'IsOverriddenByRenovation' +] + +for i in range (2): + for p in itertools.permutations (flags, r=i + 1): + response = aclib.RunTapirCommand ('FilterElements', { 'elements': allElements, 'filters': [f for f in p] }, debug=False) + print ('{} = {}'.format ('|'.join (p), len (response['filteredElements']))) + print ('-' * 30) \ No newline at end of file diff --git a/archicad-addon/Examples/get_building_material_physical_properties.py b/archicad-addon/Examples/get_building_material_physical_properties.py index 25b529a..6794525 100644 --- a/archicad-addon/Examples/get_building_material_physical_properties.py +++ b/archicad-addon/Examples/get_building_material_physical_properties.py @@ -1,16 +1,4 @@ -import json import aclib -buildMats = aclib.RunCommand ('API.GetAttributesByType', { 'attributeType' : 'BuildingMaterial' }) -print (buildMats) - -commandName = 'GetBuildingMaterialPhysicalProperties' -commandParameters = buildMats - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +response = aclib.RunTapirCommand ('GetBuildingMaterialPhysicalProperties', + aclib.RunCommand ('API.GetAttributesByType', { 'attributeType' : 'BuildingMaterial' })) \ No newline at end of file diff --git a/archicad-addon/Examples/get_classifications_of_mainelements_and_subelements.py b/archicad-addon/Examples/get_classifications_of_mainelements_and_subelements.py index 5335978..717870b 100644 --- a/archicad-addon/Examples/get_classifications_of_mainelements_and_subelements.py +++ b/archicad-addon/Examples/get_classifications_of_mainelements_and_subelements.py @@ -1,17 +1,7 @@ -import json import aclib -def ExecuteTapirCommand (commandName, commandParameters = {}): - print ('Command: {}'.format (commandName)) - print ('Parameters:') - print (json.dumps (commandParameters, indent = 4)) - response = aclib.RunTapirCommand (commandName, commandParameters) - print ('Response:') - print (json.dumps (response, indent = 4)) - return response - -mainElements = ExecuteTapirCommand ('GetSelectedElements')['elements'] -response = ExecuteTapirCommand ('GetSubelementsOfHierarchicalElements', { +mainElements = aclib.RunCommand ('API.GetAllElements', {})['elements'] +response = aclib.RunTapirCommand ('GetSubelementsOfHierarchicalElements', { 'hierarchicalElements' : mainElements }) @@ -24,12 +14,12 @@ def ExecuteTapirCommand (commandName, commandParameters = {}): classificationSystems = [{'classificationSystemId': classificationSystem['classificationSystemId']} for classificationSystem in aclib.RunCommand ('API.GetAllClassificationSystems', {})['classificationSystems']] -classificationsOfMainElements = ExecuteTapirCommand ('GetClassificationsOfElements', { +classificationsOfMainElements = aclib.RunTapirCommand ('GetClassificationsOfElements', { 'elements' : mainElements, 'classificationSystemIds' : classificationSystems }) -classificationsOfSubElements = ExecuteTapirCommand ('GetClassificationsOfElements', { +classificationsOfSubElements = aclib.RunTapirCommand ('GetClassificationsOfElements', { 'elements' : allSubElements, 'classificationSystemIds' : classificationSystems }) \ No newline at end of file diff --git a/archicad-addon/Examples/get_current_window.py b/archicad-addon/Examples/get_current_window.py index 3814761..73449dc 100644 --- a/archicad-addon/Examples/get_current_window.py +++ b/archicad-addon/Examples/get_current_window.py @@ -1,6 +1,3 @@ import aclib -import json -response = aclib.RunTapirCommand ('GetCurrentWindowType', {}) - -print (json.dumps (response['currentWindowType'], indent = 4)) +response = aclib.RunTapirCommand ('GetCurrentWindowType', {}) \ No newline at end of file diff --git a/archicad-addon/Examples/get_details_of_elements.py b/archicad-addon/Examples/get_details_of_elements.py new file mode 100644 index 0000000..fbffd72 --- /dev/null +++ b/archicad-addon/Examples/get_details_of_elements.py @@ -0,0 +1,6 @@ +import aclib + +walls = aclib.RunCommand ('API.GetElementsByType', {'elementType': 'Wall'})['elements'] +columns = aclib.RunCommand ('API.GetElementsByType', {'elementType': 'Column'})['elements'] + +response = aclib.RunTapirCommand ('GetDetailsOfElements', {'elements': walls + columns}) \ No newline at end of file diff --git a/archicad-addon/Examples/get_details_of_selected_elements.py b/archicad-addon/Examples/get_details_of_selected_elements.py deleted file mode 100644 index 0412606..0000000 --- a/archicad-addon/Examples/get_details_of_selected_elements.py +++ /dev/null @@ -1,24 +0,0 @@ -import json -import aclib - -commandName = 'GetSelectedElements' -commandParameters = {} - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) - -commandName = 'GetDetailsOfElements' -commandParameters = response - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) \ No newline at end of file diff --git a/archicad-addon/Examples/get_libraries.py b/archicad-addon/Examples/get_libraries.py index e6faad5..5f3e693 100644 --- a/archicad-addon/Examples/get_libraries.py +++ b/archicad-addon/Examples/get_libraries.py @@ -1,13 +1,3 @@ -import json import aclib -commandName = 'GetLibraries' -commandParameters = {} - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +response = aclib.RunTapirCommand ('GetLibraries', {}) diff --git a/archicad-addon/Examples/get_selected_elements.py b/archicad-addon/Examples/get_selected_elements.py index feb67b7..503b423 100644 --- a/archicad-addon/Examples/get_selected_elements.py +++ b/archicad-addon/Examples/get_selected_elements.py @@ -1,13 +1,11 @@ -import json import aclib -commandName = 'GetSelectedElements' -commandParameters = {} +walls = aclib.RunCommand ('API.GetElementsByType', {'elementType': 'Wall'})['elements'] +columns = aclib.RunCommand ('API.GetElementsByType', {'elementType': 'Column'})['elements'] -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) +aclib.RunTapirCommand ( + 'ChangeSelectionOfElements', { + 'addElementsToSelection': walls + columns + }) -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +selectedElements = aclib.RunTapirCommand ('GetSelectedElements', {}) \ No newline at end of file diff --git a/archicad-addon/Examples/highlight_elements.py b/archicad-addon/Examples/highlight_elements.py new file mode 100644 index 0000000..71dac53 --- /dev/null +++ b/archicad-addon/Examples/highlight_elements.py @@ -0,0 +1,22 @@ +import aclib +import time + +allElements = aclib.RunCommand ('API.GetAllElements', {}) + +commandName = 'HighlightElements' +commandParameters = { + 'elements' : allElements['elements'], + 'highlightedColors' : [[(i*30) % 255, 50, 50, 255] for i in range(len(allElements['elements']))], + 'wireframe3D' : True, + 'nonHighlightedColor' : [0, 0, 255, 128] +} + +response = aclib.RunTapirCommand (commandName, commandParameters) + +time.sleep (5) + +# Clear highlight +response = aclib.RunTapirCommand ('HighlightElements', { + 'elements' : [], + 'highlightedColors' : [], +}) \ No newline at end of file diff --git a/archicad-addon/Examples/highlight_selected_elements.py b/archicad-addon/Examples/highlight_selected_elements.py deleted file mode 100644 index cc1d4fd..0000000 --- a/archicad-addon/Examples/highlight_selected_elements.py +++ /dev/null @@ -1,29 +0,0 @@ -import json -import aclib - -commandName = 'GetSelectedElements' -commandParameters = {} - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) - -commandName = 'HighlightElements' -commandParameters = { - 'elements' : response['elements'], - 'highlightedColors' : [[(i*30) % 255, 50, 50, 255] for i in range(len(response['elements']))], - 'wireframe3D' : True, - 'nonHighlightedColor' : [0, 0, 255, 128] -} - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) diff --git a/archicad-addon/Examples/issue_management.py b/archicad-addon/Examples/issue_management.py index c8276be..7177ec1 100644 --- a/archicad-addon/Examples/issue_management.py +++ b/archicad-addon/Examples/issue_management.py @@ -1,127 +1,79 @@ -import json import aclib - -commandName = 'CreateIssue' -commandParameters = {'name': 'Just a sample issue', 'tagText': 'python'} - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) - - -# commandName = 'DeleteIssue' -# commandParameters = {'issueId': '4765CCCA-D30E-4A46-92B3-F544F936E089"'} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'GetIssues' -# commandParameters = {} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'AddCommentToIssue' -# commandParameters = {'issueId': 'B0D7E9D6-56E8-4432-AC74-DE7C3083015F', 'text': 'dropped da comment here', 'author': 'python', 'status': 2} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'GetCommentsFromIssue' -# commandParameters = {'issueId': 'B0D7E9D6-56E8-4432-AC74-DE7C3083015F'} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'AttachElementsToIssue' -# commandParameters = {'issueId': 'B0D7E9D6-56E8-4432-AC74-DE7C3083015F', 'elementsIds': ['22F534EF-F3CE-4A99-9E54-125E899E6AA2',], 'type': 0} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'DetachElementsFromIssue' -# commandParameters = {'issueId': 'B0D7E9D6-56E8-4432-AC74-DE7C3083015F', 'elementsIds': ['22F534EF-F3CE-4A99-9E54-125E899E6AA2',]} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'GetElementsAttachedToIssue' -# commandParameters = {'issueId': 'B0D7E9D6-56E8-4432-AC74-DE7C3083015F', 'type': 1} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'ExportIssuesToBCF' -# commandParameters = {'issuesIds': ['B0D7E9D6-56E8-4432-AC74-DE7C3083015F', '50D45AAD-9581-4275-A503-4E82C974C03B'], 'exportPath': 'C:\\Users\\i.yurasov\\Desktop\\dev\\issues_test6.bcfzip', 'useExternalId': False, 'alignBySurveyPoint': True} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - -# commandName = 'ImportIssuesFromBCF' -# commandParameters = {'importPath': 'C:\\Users\\i.yurasov\\Desktop\\dev\\issues_test5.bcfzip', 'alignBySurveyPoint': True} - -# print ('Command: {commandName}'.format (commandName = commandName)) -# print ('Parameters:') -# print (json.dumps (commandParameters, indent = 4)) - -# response = aclib.RunTapirCommand (commandName, commandParameters) -# print ('Response:') -# print (json.dumps (response, indent = 4)) - - - - - - +import tempfile +import os + +newIssue = aclib.RunTapirCommand ( + 'CreateIssue', { + 'name': 'Just a sample issue', 'tagText': 'python' + }) + +newIssue2 = aclib.RunTapirCommand ( + 'CreateIssue', { + 'name': 'Just a sample issue #2', 'tagText': 'python #2' + }) + +issues = aclib.RunTapirCommand ('GetIssues', {}) + +aclib.RunTapirCommand ( + 'AddCommentToIssue', { + 'issueId': newIssue['issueId'], + 'text': 'dropped da comment here', + 'author': 'python', + 'status': 'Info' + }) + +# Archicad cores when using GetCommentsFromIssue after CreateIssue command, but it's an Archicad bug +# comments = aclib.RunTapirCommand ('GetCommentsFromIssue', {'issueId': newIssue['issueId']}) + +for type, elementType in [('Creation', 'Wall'), + ('Highlight', 'Object'), + ('Deletion', 'Column'), + ('Modification', 'Slab')]: + aclib.RunTapirCommand ( + 'AttachElementsToIssue', { + 'issueId': newIssue['issueId'], + 'elements': aclib.RunCommand ('API.GetElementsByType', {'elementType': elementType})['elements'], + 'type': type + }) + +for type in ['Creation', 'Highlight', 'Deletion', 'Modification']: + attachedElements = aclib.RunTapirCommand ( + 'GetElementsAttachedToIssue', { + 'issueId': newIssue['issueId'], + 'type': type + }) + +exportedFilePath = os.path.join (tempfile.gettempdir (), 'issues_test.bcfzip') +aclib.RunTapirCommand ( + 'ExportIssuesToBCF', { + 'issues': [newIssue, newIssue2], + 'exportPath': exportedFilePath, + 'useExternalId': False, + 'alignBySurveyPoint': True + }) + +aclib.RunTapirCommand ( + 'DetachElementsFromIssue', { + 'issueId': newIssue['issueId'], + 'elements': aclib.RunCommand ('API.GetElementsByType', {'elementType': 'Object'})['elements'] + }) + +for type in ['Creation', 'Highlight', 'Deletion', 'Modification']: + attachedElements = aclib.RunTapirCommand ( + 'GetElementsAttachedToIssue', { + 'issueId': newIssue['issueId'], + 'type': type + }) + +aclib.RunTapirCommand ('DeleteIssue', newIssue) +aclib.RunTapirCommand ('DeleteIssue', newIssue2) + +issues = aclib.RunTapirCommand ('GetIssues', {}) + +aclib.RunTapirCommand ( + 'ImportIssuesFromBCF', { + 'importPath': exportedFilePath, + 'alignBySurveyPoint': True + }) + +issues = aclib.RunTapirCommand ('GetIssues', {}) \ No newline at end of file diff --git a/archicad-addon/Examples/manipulate_layers.py b/archicad-addon/Examples/manipulate_layers.py index dbdafe7..544c743 100644 --- a/archicad-addon/Examples/manipulate_layers.py +++ b/archicad-addon/Examples/manipulate_layers.py @@ -2,7 +2,7 @@ # Create layers -layers = [{ +newLayers = [{ 'name' : 'New Layer' },{ 'name' : 'New Hidden Layer', @@ -15,43 +15,35 @@ 'isWireframe' : True }] -result = aclib.RunTapirCommand ('CreateLayers', { - 'layerDataArray' : layers, - 'overwriteExisting' : True -}) - -print (result) +createLayersResult = aclib.RunTapirCommand ( + 'CreateLayers', { + 'layerDataArray' : newLayers, + 'overwriteExisting' : True + }) result = aclib.RunCommand ('API.GetLayerAttributes', { - 'attributeIds' : result['attributeIds'] + 'attributeIds' : createLayersResult['attributeIds'] }) -print (result) - -# Modify layer - -layers = [{ - 'name' : 'New Locked Layer', - 'isLocked' : False -}] +# Modify layer: unlock layer -result = aclib.RunTapirCommand ('CreateLayers', { - 'layerDataArray' : layers, - 'overwriteExisting' : True -}) +for layer in newLayers: + if 'isLocked' in layer and layer['isLocked']: + layer['isLocked'] = False -print (result) +createLayersResult = aclib.RunTapirCommand ( + 'CreateLayers', { + 'layerDataArray' : newLayers, + 'overwriteExisting' : True + }) result = aclib.RunCommand ('API.GetLayerAttributes', { - 'attributeIds' : result['attributeIds'] + 'attributeIds' : createLayersResult['attributeIds'] }) -print (result) - # Delete layer -result = aclib.RunCommand ('API.DeleteAttributes', { - 'attributeIds' : result['attributeIds'] -}) - -print (result) \ No newline at end of file +aclib.RunCommand ( + 'API.DeleteAttributes', { + 'attributeIds' : createLayersResult['attributeIds'] + }) \ No newline at end of file diff --git a/archicad-addon/Examples/move_selected_elements.py b/archicad-addon/Examples/move_selected_elements.py deleted file mode 100644 index 9f4f7b7..0000000 --- a/archicad-addon/Examples/move_selected_elements.py +++ /dev/null @@ -1,14 +0,0 @@ -import json -import aclib -import os -import sys - -response = aclib.RunTapirCommand ('GetSelectedElements', {}) - -deltaX = 1.0 -deltaY = 1.0 -deltaZ = 0.0 - -elementsWithMoveVectors = [{'elementId': {'guid': str (e['elementId']['guid'])}, 'moveVector': {'x': deltaX, 'y': deltaY, 'z': deltaZ}} for e in response['elements']] - -response = aclib.RunTapirCommand ('MoveElements', { 'elementsWithMoveVectors': elementsWithMoveVectors }) \ No newline at end of file diff --git a/archicad-addon/Examples/move_walls.py b/archicad-addon/Examples/move_walls.py new file mode 100644 index 0000000..d4d04a3 --- /dev/null +++ b/archicad-addon/Examples/move_walls.py @@ -0,0 +1,14 @@ +import json +import aclib +import os +import sys + +walls = aclib.RunCommand ('API.GetElementsByType', {'elementType': 'Wall'})['elements'] + +moveVector = {'x': 1.0, 'y': 1.0, 'z': 0.0} +elementsWithMoveVectors = [{'elementId': w['elementId'], 'moveVector': moveVector} for w in walls] + +aclib.RunTapirCommand ( + 'MoveElements', { + 'elementsWithMoveVectors': elementsWithMoveVectors + }) \ No newline at end of file diff --git a/archicad-addon/Examples/quit_archicad.py b/archicad-addon/Examples/quit_archicad.py index 9545ec6..86945bb 100644 --- a/archicad-addon/Examples/quit_archicad.py +++ b/archicad-addon/Examples/quit_archicad.py @@ -1,13 +1,3 @@ -import json import aclib -commandName = 'QuitArchicad' -commandParameters = {} - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +aclib.RunTapirCommand ('QuitArchicad', {}) \ No newline at end of file diff --git a/archicad-addon/Examples/reload_libraries.py b/archicad-addon/Examples/reload_libraries.py index fc99fbb..3bb8000 100644 --- a/archicad-addon/Examples/reload_libraries.py +++ b/archicad-addon/Examples/reload_libraries.py @@ -1,13 +1,3 @@ -import json import aclib -commandName = 'ReloadLibraries' -commandParameters = {} - -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +aclib.RunTapirCommand ('ReloadLibraries', {}) \ No newline at end of file diff --git a/archicad-addon/Examples/set_all_project_info.py b/archicad-addon/Examples/set_all_project_info.py deleted file mode 100644 index 7bf1891..0000000 --- a/archicad-addon/Examples/set_all_project_info.py +++ /dev/null @@ -1,10 +0,0 @@ -import json -import aclib - -response = aclib.RunTapirCommand ('GetProjectInfoFields', {}) -for field in response['fields']: - print (field) - aclib.RunTapirCommand ('SetProjectInfoField', { - 'projectInfoId' : field['projectInfoId'], - 'projectInfoValue' : 'Tapir' - }) diff --git a/archicad-addon/Examples/set_classifications_of_all_curtainwallframes.py b/archicad-addon/Examples/set_classifications_of_all_curtainwallframes.py index 5de62ad..cc8e440 100644 --- a/archicad-addon/Examples/set_classifications_of_all_curtainwallframes.py +++ b/archicad-addon/Examples/set_classifications_of_all_curtainwallframes.py @@ -1,15 +1,18 @@ import json import aclib -allCurtainWalls = aclib.RunCommand ('API.GetElementsByType', {'elementType': 'CurtainWall'})['elements'] +allCurtainWalls = aclib.RunCommand ( + 'API.GetElementsByType', { + 'elementType': 'CurtainWall' + })['elements'] print('Project contains {} Curtain Wall(s)'.format(len(allCurtainWalls))) -allCWSubelements = aclib.RunTapirCommand ('GetSubelementsOfHierarchicalElements', {'hierarchicalElements': allCurtainWalls})['subelementsOfHierarchicalElements'] -allCWFrameSubelements = [] -for cwSubelements in allCWSubelements: - for cwFrameSubelement in cwSubelements['cWallFrames']: - if 'elementId' in cwFrameSubelement: - allCWFrameSubelements.append (cwFrameSubelement) +allCWSubelements = aclib.RunTapirCommand ( + 'GetSubelementsOfHierarchicalElements', { + 'hierarchicalElements': allCurtainWalls + }, debug=False)['subelementsOfHierarchicalElements'] + +allCWFrameSubelements = [subelement for subelements in allCWSubelements for subelement in subelements['cWallFrames']] print('Project contains {} Curtain Wall Frame(s)'.format(len(allCWFrameSubelements))) classificationSystems = aclib.RunCommand ('API.GetAllClassificationSystems', {})['classificationSystems'] @@ -20,7 +23,7 @@ classificationsOfAllCWFrameSubelements = aclib.RunTapirCommand ('GetClassificationsOfElements', { 'elements' : allCWFrameSubelements, 'classificationSystemIds' : [{'classificationSystemId': s['classificationSystemId']} for s in classificationSystems] - })['elementClassifications'] + }, debug=False)['elementClassifications'] classificationIdCounter = dict() @@ -54,14 +57,14 @@ if len(cwFrameSubelementsWhichAreNotUsingThatClassificationItemGuid) > 0: print('\tSet {} Curtain Wall Frame(s) to "{}" in Classification System "{}" ...'.format(len(cwFrameSubelementsWhichAreNotUsingThatClassificationItemGuid), classificationItemGuidToName[classificationItemGuidWithTheHighestCounter], classificationSystemGuidToName[classificationSystemGuid])) response = aclib.RunTapirCommand ('SetClassificationsOfElements', { - 'elementClassifications' : [{ - 'elementId': cwFrame['elementId'], - 'classificationId': { - 'classificationSystemId': {'guid': classificationSystemGuid}, - 'classificationItemId': {'guid': classificationItemGuidWithTheHighestCounter} - } - } for cwFrame in cwFrameSubelementsWhichAreNotUsingThatClassificationItemGuid] - }) + 'elementClassifications' : [{ + 'elementId': cwFrame['elementId'], + 'classificationId': { + 'classificationSystemId': {'guid': classificationSystemGuid}, + 'classificationItemId': {'guid': classificationItemGuidWithTheHighestCounter} + } + } for cwFrame in cwFrameSubelementsWhichAreNotUsingThatClassificationItemGuid] + }, debug=False) allSucceeded = all(executionResult['success'] for executionResult in response['executionResults']) if allSucceeded: print('\tAll succeeded') diff --git a/archicad-addon/Examples/set_project_info.py b/archicad-addon/Examples/set_project_info.py new file mode 100644 index 0000000..fea801a --- /dev/null +++ b/archicad-addon/Examples/set_project_info.py @@ -0,0 +1,13 @@ +import json +import aclib + +response = aclib.RunTapirCommand ('GetProjectInfoFields', {}) + +for field in response['fields'][:5]: # Set the first five fields + aclib.RunTapirCommand ( + 'SetProjectInfoField', { + 'projectInfoId' : field['projectInfoId'], + 'projectInfoValue' : 'Tapir' + }) + +response = aclib.RunTapirCommand ('GetProjectInfoFields', {}) \ No newline at end of file diff --git a/archicad-addon/Examples/set_properties_of_subelements.py b/archicad-addon/Examples/set_properties_of_subelements.py index 76b694a..a3a734a 100644 --- a/archicad-addon/Examples/set_properties_of_subelements.py +++ b/archicad-addon/Examples/set_properties_of_subelements.py @@ -1,61 +1,59 @@ import json import aclib -commandName = 'GetSelectedElements' -commandParameters = {} -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) - -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +allCurtainWalls = aclib.RunCommand ( + 'API.GetElementsByType', { + 'elementType': 'CurtainWall' + })['elements'] commandName = 'GetSubelementsOfHierarchicalElements' commandParameters = { - 'hierarchicalElements' : response['elements'] + 'hierarchicalElements' : allCurtainWalls } -print ('Command: {commandName}'.format (commandName = commandName)) -print ('Parameters:') -print (json.dumps (commandParameters, indent = 4)) +allCWSubelements = aclib.RunTapirCommand ( + 'GetSubelementsOfHierarchicalElements', { + 'hierarchicalElements': allCurtainWalls + })['subelementsOfHierarchicalElements'] -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +allCWFrameSubelements = [subelement for subelements in allCWSubelements for subelement in subelements['cWallFrames']] elementIdPropertyId = aclib.RunCommand ('API.GetPropertyIds', {'properties': [{"type": "BuiltIn", "nonLocalizedName": "General_ElementID"}]})['properties'][0]['propertyId'] -cWallFrames = [subelement for subelements in response['subelementsOfHierarchicalElements'] for subelement in subelements['cWallFrames']] - commandName = 'GetPropertyValuesOfElements' commandParameters = { 'elements' : [{ 'elementId': subelement['elementId'] - } for subelement in cWallFrames], + } for subelement in allCWFrameSubelements], 'properties' : [{ 'propertyId': elementIdPropertyId }] } -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) +response = aclib.RunTapirCommand ( + 'GetPropertyValuesOfElements', { + 'elements' : [{ + 'elementId': subelement['elementId'] + } for subelement in allCWFrameSubelements], + 'properties' : [{ + 'propertyId': elementIdPropertyId + }] + }) -commandName = 'SetPropertyValuesOfElements' -commandParameters = {'elementPropertyValues' : []} +elementPropertyValues = [] -for i in range(len(cWallFrames)): +for i in range(len(allCWFrameSubelements)): previousElementIdOfCWallFrame = response['propertyValuesForElements'][i]['propertyValues'][0]['propertyValue']['value'] newElementIdOfCWallFrame = 'NewID-{:04d} (PrevID: {})'.format(i, previousElementIdOfCWallFrame) - commandParameters['elementPropertyValues'].append({ - 'elementId': cWallFrames[i]['elementId'], + elementPropertyValues.append({ + 'elementId': allCWFrameSubelements[i]['elementId'], 'propertyId': elementIdPropertyId, 'propertyValue': {'value': newElementIdOfCWallFrame} }) -response = aclib.RunTapirCommand (commandName, commandParameters) -print ('Response:') -print (json.dumps (response, indent = 4)) \ No newline at end of file +response = aclib.RunTapirCommand ( + 'SetPropertyValuesOfElements', { + 'elementPropertyValues' : elementPropertyValues + }) \ No newline at end of file diff --git a/archicad-addon/Sources/AddOnMain.cpp b/archicad-addon/Sources/AddOnMain.cpp index 8c157bc..7f8853c 100644 --- a/archicad-addon/Sources/AddOnMain.cpp +++ b/archicad-addon/Sources/AddOnMain.cpp @@ -22,6 +22,12 @@ static std::vector gCommandGroups; +#ifdef DEBUG +static const bool IsDebugBuild = true; +#else +static const bool IsDebugBuild = false; +#endif + template GSErrCode RegisterCommand (CommandGroup& group, const GS::UniString& version, const GS::UniString& description) { @@ -77,7 +83,9 @@ GSErrCode RegisterInterface (void) { GSErrCode err = NoError; - err |= ACAPI_MenuItem_RegisterMenu (ID_ADDON_MENU, 0, MenuCode_UserDef, MenuFlag_Default); + if (IsDebugBuild) { + err |= ACAPI_MenuItem_RegisterMenu (ID_ADDON_MENU, 0, MenuCode_UserDef, MenuFlag_Default); + } return err; } @@ -86,7 +94,9 @@ GSErrCode Initialize (void) { GSErrCode err = NoError; - err |= ACAPI_MenuItem_InstallMenuHandler (ID_ADDON_MENU, MenuCommandHandler); + if (IsDebugBuild) { + err |= ACAPI_MenuItem_InstallMenuHandler (ID_ADDON_MENU, MenuCommandHandler); + } { // Application Commands CommandGroup applicationCommands ("Application Commands"); @@ -135,6 +145,10 @@ GSErrCode Initialize (void) projectCommands, "0.1.0", "Performs a publish operation on the currently opened project. Only the given publisher set will be published." ); + err |= RegisterCommand ( + projectCommands, "1.0.7", + "Opens the given project." + ); gCommandGroups.push_back (projectCommands); } @@ -144,6 +158,10 @@ GSErrCode Initialize (void) elementCommands, "0.1.0", "Gets the list of the currently selected elements." ); + err |= RegisterCommand ( + elementCommands, "1.0.7", + "Adds/removes a number of elements to/from the current selection." + ); err |= RegisterCommand ( elementCommands, "1.0.7", "Tests an elements by the given criterias." diff --git a/archicad-addon/Sources/ApplicationCommands.cpp b/archicad-addon/Sources/ApplicationCommands.cpp index 134cf73..0e3302b 100644 --- a/archicad-addon/Sources/ApplicationCommands.cpp +++ b/archicad-addon/Sources/ApplicationCommands.cpp @@ -86,6 +86,13 @@ GS::String QuitArchicadCommand::GetName () const return "QuitArchicad"; } +GS::Optional QuitArchicadCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + GS::ObjectState QuitArchicadCommand::Execute (const GS::ObjectState& /*parameters*/, GS::ProcessControl& /*processControl*/) const { #if defined (ServerMainVers_2800) @@ -95,10 +102,10 @@ GS::ObjectState QuitArchicadCommand::Execute (const GS::ObjectState& /*parameter GSErrCode err = ACAPI_ProjectOperation_Quit (magicCode); #endif if (err != NoError) { - return CreateErrorResponse (APIERR_COMMANDFAILED, "Failed to quit Archicad!"); + return CreateFailedExecutionResult (APIERR_COMMANDFAILED, "Failed to quit Archicad!"); } - return {}; + return CreateSuccessfulExecutionResult (); } GetCurrentWindowTypeCommand::GetCurrentWindowTypeCommand () : diff --git a/archicad-addon/Sources/ApplicationCommands.hpp b/archicad-addon/Sources/ApplicationCommands.hpp index bdd8428..dc41827 100644 --- a/archicad-addon/Sources/ApplicationCommands.hpp +++ b/archicad-addon/Sources/ApplicationCommands.hpp @@ -25,6 +25,7 @@ class QuitArchicadCommand : public CommandBase public: QuitArchicadCommand (); virtual GS::String GetName () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; diff --git a/archicad-addon/Sources/AttributeCommands.cpp b/archicad-addon/Sources/AttributeCommands.cpp index dfefa2d..8cb528d 100644 --- a/archicad-addon/Sources/AttributeCommands.cpp +++ b/archicad-addon/Sources/AttributeCommands.cpp @@ -307,17 +307,17 @@ GS::Optional CreateBuildingMaterialsCommand::GetInputParametersSc void CreateBuildingMaterialsCommand::SetTypeSpecificParameters (API_Attribute& attribute, const GS::ObjectState& parameters) const { - GS::UniString id; + static GS::UniString id; if (parameters.Get ("id", id)) { attribute.buildingMaterial.id = &id; } - GS::UniString manufacturer; + static GS::UniString manufacturer; if (parameters.Get ("manufacturer", manufacturer)) { attribute.buildingMaterial.manufacturer = &manufacturer; } - GS::UniString description; + static GS::UniString description; if (parameters.Get ("description", description)) { attribute.buildingMaterial.description = &description; } diff --git a/archicad-addon/Sources/CommandBase.cpp b/archicad-addon/Sources/CommandBase.cpp index 90fa3a5..7c37aa6 100644 --- a/archicad-addon/Sources/CommandBase.cpp +++ b/archicad-addon/Sources/CommandBase.cpp @@ -61,9 +61,9 @@ GS::ObjectState CreateErrorResponse (GSErrCode errorCode, const GS::UniString& e GS::ObjectState CreateFailedExecutionResult (GSErrCode errorCode, const GS::UniString& errorMessage) { - return GS::ObjectState ( - "success", false, - "error", CreateErrorResponse (errorCode, errorMessage)); + GS::ObjectState error = CreateErrorResponse (errorCode, errorMessage); + error.Add ("success", false); + return error; } GS::ObjectState CreateSuccessfulExecutionResult () @@ -75,10 +75,21 @@ GS::ObjectState CreateSuccessfulExecutionResult () API_Guid GetGuidFromObjectState (const GS::ObjectState& os) { GS::String guid; - os.Get ("guid", guid); + if (!os.Get ("guid", guid)) { + return APINULLGuid; + } return APIGuidFromString (guid.ToCStr ()); } +API_Guid GetGuidFromArrayItem (const GS::String& idFieldName, const GS::ObjectState& os) +{ + GS::ObjectState idField; + if (!os.Get (idFieldName, idField)) { + return APINULLGuid; + } + return GetGuidFromObjectState (idField); +} + API_Coord Get2DCoordinateFromObjectState (const GS::ObjectState& objectState) { API_Coord coordinate = {}; @@ -94,7 +105,7 @@ GS::ObjectState Create2DCoordinateObjectState (const API_Coord& c) GS::ObjectState CreateIdObjectState (const GS::String& idFieldName, const API_Guid& guid) { - return GS::ObjectState (idFieldName, GS::ObjectState ("guid", APIGuidToString (guid))); + return GS::ObjectState (idFieldName, CreateGuidObjectState (guid)); } API_Coord3D Get3DCoordinateFromObjectState (const GS::ObjectState& objectState) diff --git a/archicad-addon/Sources/CommandBase.hpp b/archicad-addon/Sources/CommandBase.hpp index d296f68..5f46ebf 100644 --- a/archicad-addon/Sources/CommandBase.hpp +++ b/archicad-addon/Sources/CommandBase.hpp @@ -35,12 +35,18 @@ GS::ObjectState CreateFailedExecutionResult (GSErrCode errorCode, const GS::UniS GS::ObjectState CreateSuccessfulExecutionResult (); API_Guid GetGuidFromObjectState (const GS::ObjectState& os); +API_Guid GetGuidFromArrayItem (const GS::String& idFieldName, const GS::ObjectState& os); +inline API_Guid GetGuidFromElementsArrayItem (const GS::ObjectState& os) { return GetGuidFromArrayItem ("elementId", os); } +inline API_Guid GetGuidFromAttributesArrayItem (const GS::ObjectState& os) { return GetGuidFromArrayItem ("attributeId", os); } +inline API_Guid GetGuidFromIssuesArrayItem (const GS::ObjectState& os) { return GetGuidFromArrayItem ("issueId", os); } API_Coord Get2DCoordinateFromObjectState (const GS::ObjectState& objectState); API_Coord3D Get3DCoordinateFromObjectState (const GS::ObjectState& objectState); GS::ObjectState Create2DCoordinateObjectState (const API_Coord& c); +inline GS::ObjectState CreateGuidObjectState (const API_Guid& guid) { return GS::ObjectState ("guid", APIGuidToString (guid)); } GS::ObjectState CreateIdObjectState (const GS::String& idFieldName, const API_Guid& guid); inline GS::ObjectState CreateElementIdObjectState (const API_Guid& guid) { return CreateIdObjectState ("elementId", guid); } inline GS::ObjectState CreateAttributeIdObjectState (const API_Guid& guid) { return CreateIdObjectState ("attributeId", guid); } +inline GS::ObjectState CreateIssueIdObjectState (const API_Guid& guid) { return CreateIdObjectState ("issueId", guid); } struct Story { Story (short _index, double _level) diff --git a/archicad-addon/Sources/ElementCommands.cpp b/archicad-addon/Sources/ElementCommands.cpp index 1f9978f..02364cb 100644 --- a/archicad-addon/Sources/ElementCommands.cpp +++ b/archicad-addon/Sources/ElementCommands.cpp @@ -47,6 +47,9 @@ GS::Optional GetDetailsOfElementsCommand::GetResponseSchema () co "layerIndex": { "type": "number" }, + "drawIndex": { + "type": "number" + }, "details": { "type": "object", "oneOf": [ @@ -194,6 +197,7 @@ GS::ObjectState GetDetailsOfElementsCommand::Execute (const GS::ObjectState& par #else detailsOfElement.Add ("layerIndex", elem.header.layer); #endif + detailsOfElement.Add ("drawIndex", elem.header.drwIndex); GS::ObjectState typeSpecificDetails; @@ -320,7 +324,97 @@ GS::ObjectState GetSelectedElementsCommand::Execute (const GS::ObjectState& /*pa return response; } +ChangeSelectionOfElementsCommand::ChangeSelectionOfElementsCommand () : + CommandBase (CommonSchema::Used) +{ +} + +GS::String ChangeSelectionOfElementsCommand::GetName () const +{ + return "ChangeSelectionOfElements"; +} + +GS::Optional ChangeSelectionOfElementsCommand::GetInputParametersSchema () const +{ + return R"({ + "type": "object", + "properties": { + "addElementsToSelection": { + "$ref": "#/Elements" + }, + "removeElementsFromSelection": { + "$ref": "#/Elements" + } + }, + "additionalProperties": false, + "required": [ + ] + })"; +} + +GS::Optional ChangeSelectionOfElementsCommand::GetResponseSchema () const +{ + return R"({ + "type": "object", + "properties": { + "executionResultsOfAddToSelection": { + "$ref": "#/ExecutionResults" + }, + "executionResultsOfRemoveFromSelection": { + "$ref": "#/ExecutionResults" + } + }, + "additionalProperties": false, + "required": [ + "executionResultsOfAddToSelection", + "executionResultsOfRemoveFromSelection" + ] + })"; +} + +GS::ObjectState ChangeSelectionOfElementsCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const +{ + GS::Array addElementsToSelection; + parameters.Get ("addElementsToSelection", addElementsToSelection); + GS::Array removeElementsFromSelection; + parameters.Get ("removeElementsFromSelection", removeElementsFromSelection); + + GS::ObjectState response; + const auto& executionResultsOfAddToSelection = response.AddList ("executionResultsOfAddToSelection"); + const auto& executionResultsOfRemoveFromSelection = response.AddList ("executionResultsOfRemoveFromSelection"); + + for (const GS::ObjectState& element : addElementsToSelection) { + const GS::ObjectState* elementId = element.Get ("elementId"); + if (elementId == nullptr) { + executionResultsOfAddToSelection (CreateFailedExecutionResult (APIERR_BADPARS, "elementId is missing")); + continue; + } + const GSErrCode err = ACAPI_Selection_Select ({ API_Neig (GetGuidFromObjectState (*elementId)) }, true); + if (err != NoError) { + executionResultsOfAddToSelection (CreateFailedExecutionResult (err, "Failed to add to selection")); + } else { + executionResultsOfAddToSelection (CreateSuccessfulExecutionResult ()); + } + } + + for (const GS::ObjectState& element : removeElementsFromSelection) { + const GS::ObjectState* elementId = element.Get ("elementId"); + if (elementId == nullptr) { + executionResultsOfRemoveFromSelection (CreateFailedExecutionResult (APIERR_BADPARS, "elementId is missing")); + continue; + } + + const GSErrCode err = ACAPI_Selection_Select ({ API_Neig (GetGuidFromObjectState (*elementId)) }, false); + if (err != NoError) { + executionResultsOfRemoveFromSelection (CreateFailedExecutionResult (err, "Failed to remove from selection")); + } else { + executionResultsOfRemoveFromSelection (CreateSuccessfulExecutionResult ()); + } + } + + return response; +} GetSubelementsOfHierarchicalElementsCommand::GetSubelementsOfHierarchicalElementsCommand () : CommandBase (CommonSchema::Used) @@ -602,6 +696,22 @@ GS::Optional MoveElementsCommand::GetInputParametersSchema () con })"; } +GS::Optional MoveElementsCommand::GetResponseSchema () const +{ + return R"({ + "type": "object", + "properties": { + "executionResults": { + "$ref": "#/ExecutionResults" + } + }, + "additionalProperties": false, + "required": [ + "executionResults" + ] + })"; +} + static GSErrCode MoveElement (const API_Guid& elemGuid, const API_Vector3D& moveVector, bool withCopy) { GS::Array elementsToEdit = { API_Neig (elemGuid) }; @@ -619,16 +729,24 @@ GS::ObjectState MoveElementsCommand::Execute (const GS::ObjectState& parameters, GS::Array elementsWithMoveVectors; parameters.Get ("elementsWithMoveVectors", elementsWithMoveVectors); - API_Guid elemGuid; - const GSErrCode err = ACAPI_CallUndoableCommand ("Move Elements", [&] () -> GSErrCode { + GS::ObjectState response; + const auto& executionResults = response.AddList ("executionResults"); + + ACAPI_CallUndoableCommand ("Move Elements", [&] () -> GSErrCode { for (const GS::ObjectState& elementWithMoveVector : elementsWithMoveVectors) { const GS::ObjectState* elementId = elementWithMoveVector.Get ("elementId"); + if (elementId == nullptr) { + executionResults (CreateFailedExecutionResult (APIERR_BADPARS, "elementId is missing")); + continue; + } + const GS::ObjectState* moveVector = elementWithMoveVector.Get ("moveVector"); - if (elementId == nullptr || moveVector == nullptr) { + if (moveVector == nullptr) { + executionResults (CreateFailedExecutionResult (APIERR_BADPARS, "moveVector is missing")); continue; } - elemGuid = GetGuidFromObjectState (*elementId); + const API_Guid elemGuid = GetGuidFromObjectState (*elementId); bool copy = false; elementWithMoveVector.Get ("copy", copy); @@ -637,19 +755,17 @@ GS::ObjectState MoveElementsCommand::Execute (const GS::ObjectState& parameters, Get3DCoordinateFromObjectState (*moveVector), copy); if (err != NoError) { - return err; + const GS::UniString errorMsg = GS::UniString::Printf ("Failed to move element with guid %T!", APIGuidToString (elemGuid).ToPrintf ()); + executionResults (CreateFailedExecutionResult (err, errorMsg)); + } else { + executionResults (CreateSuccessfulExecutionResult ()); } } return NoError; }); - if (err != NoError) { - const GS::UniString errorMsg = GS::UniString::Printf ("Failed to move element with guid %T!", APIGuidToString (elemGuid).ToPrintf ()); - return CreateErrorResponse (err, errorMsg); - } - - return {}; + return response; } GetGDLParametersOfElementsCommand::GetGDLParametersOfElementsCommand () : @@ -924,7 +1040,7 @@ GS::ObjectState GetGDLParametersOfElementsCommand::Execute (const GS::ObjectStat for (const GS::ObjectState& element : elements) { const GS::ObjectState* elementId = element.Get ("elementId"); if (elementId == nullptr) { - continue; + listAdder (CreateErrorResponse (APIERR_BADPARS, "elementId is missing")); } elemGuid = GetGuidFromObjectState (*elementId); @@ -987,7 +1103,7 @@ GS::ObjectState GetGDLParametersOfElementsCommand::Execute (const GS::ObjectStat ACAPI_DisposeAddParHdl (&memo.params); } else { const GS::UniString errorMsg = GS::UniString::Printf ("Failed to get parameters of element with guid %T!", APIGuidToString (elemGuid).ToPrintf ()); - return CreateErrorResponse (err, errorMsg); + listAdder (CreateErrorResponse (err, errorMsg)); } } @@ -1037,30 +1153,47 @@ GS::Optional SetGDLParametersOfElementsCommand::GetInputParameter })"; } +GS::Optional SetGDLParametersOfElementsCommand::GetResponseSchema () const +{ + return R"({ + "type": "object", + "properties": { + "executionResults": { + "$ref": "#/ExecutionResults" + } + }, + "additionalProperties": false, + "required": [ + "executionResults" + ] + })"; +} + GS::ObjectState SetGDLParametersOfElementsCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { GS::Array elementsWithGDLParameters; parameters.Get ("elementsWithGDLParameters", elementsWithGDLParameters); - bool invalidParameter = false; - bool notAbleToChangeParameter = false; - GS::String badParameterName; + GS::ObjectState response; + const auto& executionResults = response.AddList ("executionResults"); - API_Guid elemGuid; - const GSErrCode err = ACAPI_CallUndoableCommand ("Set GDL Parameters of Elements", [&] () -> GSErrCode { - GSErrCode err = NoError; + ACAPI_CallUndoableCommand ("Set GDL Parameters of Elements", [&] () -> GSErrCode { for (const GS::ObjectState& elementWithGDLParameters : elementsWithGDLParameters) { + GSErrCode err = NoError; + GS::UniString errMessage; const GS::ObjectState* elementId = elementWithGDLParameters.Get ("elementId"); if (elementId == nullptr) { + executionResults (CreateFailedExecutionResult (APIERR_BADPARS, "elementId is missing")); continue; } const GS::ObjectState* gdlParameters = elementWithGDLParameters.Get ("gdlParameters"); if (gdlParameters == nullptr) { + executionResults (CreateFailedExecutionResult (APIERR_BADPARS, "gdlParameters is missing")); continue; } - elemGuid = GetGuidFromObjectState (*elementId); + const API_Guid elemGuid = GetGuidFromObjectState (*elementId); API_ParamOwnerType paramOwner = {}; @@ -1103,9 +1236,9 @@ GS::ObjectState SetGDLParametersOfElementsCommand::Execute (const GS::ObjectStat #endif if (!gdlParametersTypeDictionary.ContainsKey (parameterName)) { - invalidParameter = true; - badParameterName = parameterName; - return APIERR_BADPARS; + errMessage = GS::UniString::Printf ("Invalid input: %s is not a GDL parameter of element %T", parameterName.ToCStr (), APIGuidToString (elemGuid).ToPrintf ()); + err = APIERR_BADPARS; + break; } CHTruncate (parameterName.ToCStr (), changeParam.name, sizeof (changeParam.name)); @@ -1141,79 +1274,77 @@ GS::ObjectState SetGDLParametersOfElementsCommand::Execute (const GS::ObjectStat err = ACAPI_LibraryPart_ChangeAParameter (&changeParam); if (err != NoError) { - notAbleToChangeParameter = true; - badParameterName = parameterName; - return APIERR_BADPARS; + errMessage = GS::UniString::Printf ("Failed to change parameter %s of element with guid %T", parameterName.ToCStr (), APIGuidToString (elemGuid).ToPrintf ()); + break; } ACAPI_DisposeAddParHdl (&getParams.params); ACAPI_LibraryPart_GetActParameters (&getParams); } - API_Element element = {}; - element.header.guid = elemGuid; - - err = ACAPI_Element_Get (&element); if (err == NoError) { - API_Element mask = {}; - API_ElementMemo memo = {}; + API_Element element = {}; + element.header.guid = elemGuid; + + err = ACAPI_Element_Get (&element); + if (err == NoError) { + API_Element mask = {}; + API_ElementMemo memo = {}; - ACAPI_ELEMENT_MASK_CLEAR (mask); + ACAPI_ELEMENT_MASK_CLEAR (mask); #ifdef ServerMainVers_2600 - switch (element.header.type.typeID) { + switch (element.header.type.typeID) { #else - switch (element.header.typeID) { + switch (element.header.typeID) { #endif - case API_ObjectID: - element.object.xRatio = getParams.a; - element.object.yRatio = getParams.b; - ACAPI_ELEMENT_MASK_SET (mask, API_ObjectType, xRatio); - ACAPI_ELEMENT_MASK_SET (mask, API_ObjectType, yRatio); - break; - case API_WindowID: - case API_DoorID: - element.window.openingBase.width = getParams.a; - element.window.openingBase.height = getParams.b; - ACAPI_ELEMENT_MASK_SET (mask, API_WindowType, openingBase.width); - ACAPI_ELEMENT_MASK_SET (mask, API_WindowType, openingBase.height); - break; - case API_SkylightID: - element.skylight.openingBase.width = getParams.a; - element.skylight.openingBase.height = getParams.b; - ACAPI_ELEMENT_MASK_SET (mask, API_SkylightType, openingBase.width); - ACAPI_ELEMENT_MASK_SET (mask, API_SkylightType, openingBase.height); - break; - default: - // Not supported yet - break; - } + case API_ObjectID: + element.object.xRatio = getParams.a; + element.object.yRatio = getParams.b; + ACAPI_ELEMENT_MASK_SET (mask, API_ObjectType, xRatio); + ACAPI_ELEMENT_MASK_SET (mask, API_ObjectType, yRatio); + break; + case API_WindowID: + case API_DoorID: + element.window.openingBase.width = getParams.a; + element.window.openingBase.height = getParams.b; + ACAPI_ELEMENT_MASK_SET (mask, API_WindowType, openingBase.width); + ACAPI_ELEMENT_MASK_SET (mask, API_WindowType, openingBase.height); + break; + case API_SkylightID: + element.skylight.openingBase.width = getParams.a; + element.skylight.openingBase.height = getParams.b; + ACAPI_ELEMENT_MASK_SET (mask, API_SkylightType, openingBase.width); + ACAPI_ELEMENT_MASK_SET (mask, API_SkylightType, openingBase.height); + break; + default: + // Not supported yet + break; + } - memo.params = getParams.params; - err = ACAPI_Element_Change (&element, &mask, &memo, APIMemoMask_AddPars, true); + memo.params = getParams.params; + err = ACAPI_Element_Change (&element, &mask, &memo, APIMemoMask_AddPars, true); + } } } ACAPI_LibraryPart_CloseParameters (); ACAPI_DisposeAddParHdl (&getParams.params); } - } - - return err; - }); - if (err != NoError) { - GS::UniString errorMsg; - if (invalidParameter) { - errorMsg = GS::UniString::Printf ("Invalid input: %s is not a GDL parameter of element %T", badParameterName.ToCStr (), APIGuidToString (elemGuid).ToPrintf ()); - } else if (notAbleToChangeParameter) { - errorMsg = GS::UniString::Printf ("Failed to change parameter %s of element with guid %T", badParameterName.ToCStr (), APIGuidToString (elemGuid).ToPrintf ()); - } else { - errorMsg = GS::UniString::Printf ("Failed to change parameters of element with guid %T", APIGuidToString (elemGuid).ToPrintf ()); + if (err != NoError) { + if (errMessage.IsEmpty ()) { + executionResults (CreateFailedExecutionResult (err, GS::UniString::Printf ("Failed to change parameters of element with guid %T", APIGuidToString (elemGuid).ToPrintf ()))); + } else { + executionResults (CreateFailedExecutionResult (err, errMessage)); + } + } else { + executionResults (CreateSuccessfulExecutionResult ()); + } } - return CreateErrorResponse (err, errorMsg); - } + return NoError; + }); - return {}; + return response; } FilterElementsCommand::FilterElementsCommand () : @@ -1385,7 +1516,9 @@ GS::Optional HighlightElementsCommand::GetInputParametersSchema ( GS::Optional HighlightElementsCommand::GetResponseSchema () const { - return {}; + return R"({ + "$ref": "#/ExecutionResult" + })"; } #ifdef ServerMainVers_2600 @@ -1419,14 +1552,14 @@ GS::ObjectState HighlightElementsCommand::Execute (const GS::ObjectState& parame ACAPI_UserInput_ClearElementHighlight (); // need to call redraw for changes to take effect ACAPI_View_Redraw (); - return {}; + return CreateSuccessfulExecutionResult (); } GS::Array> highlightedColors; parameters.Get ("highlightedColors", highlightedColors); if (highlightedColors.GetSize () != elements.GetSize ()) { - return CreateErrorResponse (APIERR_BADPARS, "The size of 'elements' array and 'highlightedColors' array does not match."); + return CreateFailedExecutionResult (APIERR_BADPARS, "The size of 'elements' array and 'highlightedColors' array does not match."); } GS::HashTable elementsWithColors; @@ -1452,14 +1585,14 @@ GS::ObjectState HighlightElementsCommand::Execute (const GS::ObjectState& parame // need to call redraw for changes to take effect ACAPI_View_Redraw (); - return {}; + return CreateSuccessfulExecutionResult (); } #else GS::ObjectState HighlightElementsCommand::Execute (const GS::ObjectState& /*parameters*/, GS::ProcessControl& /*processControl*/) const { - return CreateErrorResponse (APIERR_GENERAL, GetName() + " command is not supported for this AC version."); + return CreateFailedExecutionResult (APIERR_GENERAL, GetName () + " command is not supported for this AC version."); } #endif \ No newline at end of file diff --git a/archicad-addon/Sources/ElementCommands.hpp b/archicad-addon/Sources/ElementCommands.hpp index 682e826..73aba35 100644 --- a/archicad-addon/Sources/ElementCommands.hpp +++ b/archicad-addon/Sources/ElementCommands.hpp @@ -21,6 +21,16 @@ class GetSelectedElementsCommand : public CommandBase virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; +class ChangeSelectionOfElementsCommand : public CommandBase +{ +public: + ChangeSelectionOfElementsCommand (); + virtual GS::String GetName () const override; + virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; + virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; +}; + class GetSubelementsOfHierarchicalElementsCommand : public CommandBase { public: @@ -37,6 +47,7 @@ class MoveElementsCommand : public CommandBase MoveElementsCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; @@ -56,6 +67,7 @@ class SetGDLParametersOfElementsCommand : public CommandBase SetGDLParametersOfElementsCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; diff --git a/archicad-addon/Sources/ElementCreationCommands.cpp b/archicad-addon/Sources/ElementCreationCommands.cpp index 2ec9dd7..530839d 100644 --- a/archicad-addon/Sources/ElementCreationCommands.cpp +++ b/archicad-addon/Sources/ElementCreationCommands.cpp @@ -56,7 +56,11 @@ GS::ObjectState CreateElementsCommandBase::Execute (const GS::ObjectState& param GSErrCode err = ACAPI_Element_GetDefaults (&element, &memo); for (const GS::ObjectState& data : dataArray) { - SetTypeSpecificParameters (element, memo, stories, data); + auto os = SetTypeSpecificParameters (element, memo, stories, data); + if (os.HasValue ()) { + elements (*os); + continue; + } err = ACAPI_Element_Create (&element, &memo); if (err != NoError) { diff --git a/archicad-addon/Sources/IssueCommands.cpp b/archicad-addon/Sources/IssueCommands.cpp index a6989e0..886378d 100644 --- a/archicad-addon/Sources/IssueCommands.cpp +++ b/archicad-addon/Sources/IssueCommands.cpp @@ -70,7 +70,7 @@ static GSErrCode GetIFCRelationshipData (GS::HashTable CreateIssueCommand::GetInputParametersSchema () cons "type": "string", "description": "The name of the issue." }, - "parentId": { - "type": "string", - "description": "The id of the parent issue, optional." + "parentIssueId": { + "$ref": "#/IssueId" }, "tagText": { "type": "string", @@ -104,37 +103,51 @@ GS::Optional CreateIssueCommand::GetInputParametersSchema () cons })"; } +GS::Optional CreateIssueCommand::GetResponseSchema () const +{ + return R"({ + "type": "object", + "properties": { + "issueId": { + "$ref": "#/IssueId" + } + }, + "additionalProperties": false, + "required": [ + "issueId" + ] + })"; +} + GS::ObjectState CreateIssueCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { GS::UniString name; - GS::UniString parentIdStr = ""; + GS::ObjectState parentIssueId; GS::UniString tagText = ""; - parameters.Get ("parentId", parentIdStr); parameters.Get ("tagText", tagText); if (!parameters.Get ("name", name)) { - return CreateErrorResponse (Error, "Invalid input parameters."); + return CreateErrorResponse (APIERR_BADPARS, "Invalid input parameters."); } API_MarkUpType issue (name); issue.tagText = tagText; - if (parentIdStr != "") - issue.parentGuid = APIGuidFromString (parentIdStr.ToCStr ()); + if (parameters.Get ("parentIssueId", parentIssueId)) + issue.parentGuid = GetGuidFromObjectState (parentIssueId); GSErrCode err = ACAPI_CallUndoableCommand ("Create issue", [&]() -> GSErrCode { - err = ACAPI_Markup_Create (issue); - return err; + return ACAPI_Markup_Create (issue); }); if (err != NoError) { return CreateErrorResponse (err, "Failed to create issue."); } - return {}; + return CreateIdObjectState ("issueId", issue.guid); } DeleteIssueCommand::DeleteIssueCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -149,8 +162,11 @@ GS::Optional DeleteIssueCommand::GetInputParametersSchema () cons "type": "object", "properties": { "issueId": { - "type": "string", - "description": "The id of the issue to delete." + "$ref": "#/IssueId" + }, + "acceptAllElements": { + "type": "boolean", + "description": "Accept all creation/deletion/modification of the deleted issue. By default false." } }, "additionalProperties": false, @@ -160,31 +176,37 @@ GS::Optional DeleteIssueCommand::GetInputParametersSchema () cons })"; } +GS::Optional DeleteIssueCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + GS::ObjectState DeleteIssueCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { - GS::UniString issueIdStr; + GS::ObjectState issueId; bool acceptAllElements = false; - if (!parameters.Get ("issueId", issueIdStr)) { - return CreateErrorResponse (Error, "Invalid input parameters."); + if (!parameters.Get ("issueId", issueId)) { + return CreateFailedExecutionResult (Error, "Invalid input parameters."); } parameters.Get ("acceptAllElements", acceptAllElements); - API_Guid guid = APIGuidFromString (issueIdStr.ToCStr ()); + API_Guid guid = GetGuidFromObjectState (issueId); GSErrCode err = ACAPI_CallUndoableCommand ("Delete issue", [&]() -> GSErrCode { - err = ACAPI_Markup_Delete (guid, acceptAllElements); - return err; + return ACAPI_Markup_Delete (guid, acceptAllElements); }); if (err != NoError) { - return CreateErrorResponse (err, "Failed to delete issue."); + return CreateFailedExecutionResult (err, "Failed to delete issue."); } - return {}; + return CreateSuccessfulExecutionResult (); } GetIssuesCommand::GetIssuesCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -204,17 +226,15 @@ GS::Optional GetIssuesCommand::GetResponseSchema () const "items": { "type": "object", "properties": { - "guid": { - "type": "string", - "description": "Issue identifier" + "issueId": { + "$ref": "#/IssueId" }, "name": { "type": "string", "description": "Issue name" }, - "parentGuid": { - "type": "string", - "description": "The identifier of the parent issue" + "parentIssueId": { + "$ref": "#/IssueId" }, "creaTime": { "type": "integer", @@ -228,9 +248,8 @@ GS::Optional GetIssuesCommand::GetResponseSchema () const "type": "string", "description": "Issue tag text - labels" }, - "tagTextElemGuid": { - "type": "string", - "description": "The identifier of the attached tag text element" + "tagTextElementId": { + "$ref": "#/ElementId" }, "isTagTextElemVisible": { "type": "boolean", @@ -239,13 +258,13 @@ GS::Optional GetIssuesCommand::GetResponseSchema () const }, "additionalProperties": false, "required": [ - "guid", + "issueId", "name", - "parentGuid", + "parentIssueId", "creaTime", "modiTime", "tagText", - "tagTextElemGuid", + "tagTextElementId", "isTagTextElemVisible" ] } @@ -271,13 +290,13 @@ GS::ObjectState GetIssuesCommand::Execute (const GS::ObjectState& /*parameters*/ for (auto i = issueList.Enumerate (); i != nullptr; ++i) { GS::ObjectState issueData; - issueData.Add ("guid", APIGuidToString (i->guid)); + issueData.Add ("issueId", CreateGuidObjectState (i->guid)); issueData.Add ("name", i->name); - issueData.Add ("parentGuid", APIGuidToString (i->parentGuid)); + issueData.Add ("parentIssueId", CreateGuidObjectState (i->parentGuid)); issueData.Add ("creaTime", i->creaTime); issueData.Add ("modiTime", i->modiTime); issueData.Add ("tagText", i->tagText); - issueData.Add ("tagTextElemGuid", APIGuidToString (i->tagTextElemGuid)); + issueData.Add ("tagTextElementId", CreateGuidObjectState (i->tagTextElemGuid)); issueData.Add ("isTagTextElemVisible", i->isTagTextElemVisible); listAdder (issueData); } @@ -286,7 +305,7 @@ GS::ObjectState GetIssuesCommand::Execute (const GS::ObjectState& /*parameters*/ } AddCommentToIssueCommand::AddCommentToIssueCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -301,16 +320,14 @@ GS::Optional AddCommentToIssueCommand::GetInputParametersSchema ( "type": "object", "properties": { "issueId": { - "type": "string", - "description": "The id of the issue to add the comment." + "$ref": "#/IssueId" }, "author": { "type": "string", "description": "The author of the new comment." }, "status": { - "type": "integer", - "description": "Comment status type." + "$ref": "#/IssueCommentStatus" }, "text": { "type": "string", @@ -325,41 +342,58 @@ GS::Optional AddCommentToIssueCommand::GetInputParametersSchema ( })"; } +GS::Optional AddCommentToIssueCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + +static API_MarkUpCommentStatusID ConvertStringToMarkUpCommentStatusID (const GS::UniString& str) +{ + if (str == "Error") return APIComment_Error; + if (str == "Warning") return APIComment_Warning; + if (str == "Info") return APIComment_Info; + return APIComment_Unknown; +} + +static GS::UniString ConvertMarkUpCommentStatusIDToString (API_MarkUpCommentStatusID id) +{ + switch (id) { + case APIComment_Error: return "Error"; + case APIComment_Warning: return "Warning"; + case APIComment_Info: return "Info"; + default: return "Unknown"; + } +} + GS::ObjectState AddCommentToIssueCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { - GS::UniString issueIdStr; + GS::ObjectState issueId; GS::UniString text; GS::UniString author = "API"; - int status; + GS::UniString status; parameters.Get ("author", author); parameters.Get ("status", status); - if (!parameters.Get ("issueId", issueIdStr) || !parameters.Get ("text", text)) { - return CreateErrorResponse (Error, "Invalid input parameters."); + if (!parameters.Get ("issueId", issueId) || !parameters.Get ("text", text)) { + return CreateFailedExecutionResult (Error, "Invalid input parameters."); } - auto GetCommentStatus = [](int status) -> API_MarkUpCommentStatusID { - if (status >= 0 && status <= 3) { - return static_cast(status); - } else { - return APIComment_Unknown; - } - }; - API_Guid guid = APIGuidFromString (issueIdStr.ToCStr ()); + API_Guid guid = GetGuidFromObjectState (issueId); GSErrCode err = ACAPI_CallUndoableCommand ("Add comment", [&]() -> GSErrCode { - API_MarkUpCommentType comment (author, text, GetCommentStatus (status)); - GSErrCode err = ACAPI_Markup_AddComment (guid, comment); - return err; + API_MarkUpCommentType comment (author, text, ConvertStringToMarkUpCommentStatusID (status)); + return ACAPI_Markup_AddComment (guid, comment); }); if (err != NoError) - return CreateErrorResponse (err, "Failed to create a comment."); + return CreateFailedExecutionResult (err, "Failed to create a comment."); - return {}; + return CreateSuccessfulExecutionResult (); } GetCommentsFromIssueCommand::GetCommentsFromIssueCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -374,8 +408,7 @@ GS::Optional GetCommentsFromIssueCommand::GetInputParametersSchem "type": "object", "properties": { "issueId": { - "type": "string", - "description": "The id of the issue to get the comments." + "$ref": "#/IssueId" } }, "additionalProperties": false, @@ -397,7 +430,7 @@ GS::Optional GetCommentsFromIssueCommand::GetResponseSchema () co "type": "object", "properties": { "guid": { - "type": "string", + "$ref": "#/Guid", "description": "Comment identifier" }, "author": { @@ -409,8 +442,7 @@ GS::Optional GetCommentsFromIssueCommand::GetResponseSchema () co "description": "Comment text" }, "status": { - "type": "string", - "description": "Comment status" + "$ref": "#/IssueCommentStatus" }, "creaTime": { "type": "integer", @@ -437,42 +469,36 @@ GS::Optional GetCommentsFromIssueCommand::GetResponseSchema () co GS::ObjectState GetCommentsFromIssueCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { - GS::UniString issueIdStr; - if (!parameters.Get ("issueId", issueIdStr)) { - return CreateErrorResponse (Error, "Invalid input parameters."); + GS::ObjectState issueId; + if (!parameters.Get ("issueId", issueId)) { + return CreateErrorResponse (APIERR_BADPARS, "Invalid input parameters."); } - API_Guid issueId = APIGuidFromString (issueIdStr.ToCStr ()); GS::Array comments; - ACAPI_Markup_GetComments (issueId, &comments); + GSErrCode err = ACAPI_Markup_GetComments (GetGuidFromObjectState (issueId), &comments); + + if (err != NoError) { + return CreateErrorResponse (err, "Failed to get comments for the given issue."); + } GS::ObjectState response; const auto& listAdder = response.AddList ("comments"); - comments.Enumerate ([&listAdder](const API_MarkUpCommentType& comment) { - auto GetCommentStatusStr = [](API_MarkUpCommentStatusID commentStatusID) -> const char* { - switch (commentStatusID) { - case APIComment_Error: return "Error"; - case APIComment_Warning: return "Warning"; - case APIComment_Info: return "Info"; - case APIComment_Unknown: - default: return "Unknown"; - } - }; + for (const API_MarkUpCommentType& comment : comments) { GS::ObjectState commentData; commentData.Add ("guid", APIGuidToString (comment.guid)); commentData.Add ("author", comment.author); commentData.Add ("text", comment.text); - commentData.Add ("status", GetCommentStatusStr (comment.status)); + commentData.Add ("status", ConvertMarkUpCommentStatusIDToString (comment.status)); commentData.Add ("creaTime", comment.creaTime); listAdder (commentData); - }); + } return response; } AttachElementsToIssueCommand::AttachElementsToIssueCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -487,58 +513,71 @@ GS::Optional AttachElementsToIssueCommand::GetInputParametersSche "type": "object", "properties": { "issueId": { - "type": "string", - "description": "The id of the issue to attach elements." + "$ref": "#/IssueId" }, - "elementsIds": { + "elements": { "$ref": "#/Elements" }, "type": { - "type": "integer", - "description": "Attachment type status." + "$ref": "#/IssueElementType" } }, "additionalProperties": false, "required": [ "issueId", - "elementsIds", + "elements", "type" ] })"; } +GS::Optional AttachElementsToIssueCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + +static API_MarkUpComponentTypeID ConvertStringToMarkUpComponentTypeID (const GS::UniString& type) +{ + if (type == "Creation") { + return API_MarkUpComponentTypeID (0); + } else if (type == "Highlight") { + return API_MarkUpComponentTypeID (1); + } else if (type == "Deletion") { + return API_MarkUpComponentTypeID (2); + } else if (type == "Modification") { + return API_MarkUpComponentTypeID (3); + } + + return API_MarkUpComponentTypeID (0); +} + GS::ObjectState AttachElementsToIssueCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl&) const { - int type; - GS::UniString issueIdStr; - API_Guid issueId; - GS::Array elemIdsStr; - GS::Array elemIds; + GS::UniString type; + GS::ObjectState issueId; + GS::Array elements; - parameters.Get ("type", type); - if (!parameters.Get ("issueId", issueIdStr) || !parameters.Get ("elementsIds", elemIdsStr) || !(type >= 0 && type <= 3)) { - return CreateErrorResponse (Error, "Invalid input parameters."); - } else { - issueId = APIGuidFromString (issueIdStr.ToCStr ()); - for (ULong i = 0; i < elemIdsStr.GetSize (); ++i) { - elemIds.Push (APIGuidFromString (elemIdsStr[i].ToCStr ())); - } + if (!parameters.Get ("type", type) || !parameters.Get ("issueId", issueId) || !parameters.Get ("elements", elements)) { + return CreateFailedExecutionResult (Error, "Invalid input parameters."); } + const GS::Array elemIds = elements.Transform (GetGuidFromElementsArrayItem); + GSErrCode err = ACAPI_CallUndoableCommand ("Attach elements", [&]() -> GSErrCode { - err = TAPIR_MarkUp_AttachElements (issueId, elemIds, type); - return err; + return TAPIR_MarkUp_AttachElements (GetGuidFromObjectState (issueId), elemIds, ConvertStringToMarkUpComponentTypeID (type)); }); if (err != NoError) { - return CreateErrorResponse (Error, "Failed to attach elements."); + return CreateFailedExecutionResult (Error, "Failed to attach elements."); } - return {}; + return CreateSuccessfulExecutionResult (); } DetachElementsFromIssueCommand::DetachElementsFromIssueCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -553,47 +592,51 @@ GS::Optional DetachElementsFromIssueCommand::GetInputParametersSc "type": "object", "properties": { "issueId": { - "type": "string", - "description": "The id of the issue to deattach elements." + "$ref": "#/IssueId" }, - "elementsIds": { + "elements": { "$ref": "#/Elements" } }, "additionalProperties": false, "required": [ "issueId", - "elementsIds" + "elements" ] })"; } +GS::Optional DetachElementsFromIssueCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + GS::ObjectState DetachElementsFromIssueCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { - GS::UniString issueIdStr; - API_Guid issueId; - GS::Array elemIdsStr; - GS::Array elemIds; + GS::ObjectState issueId; + GS::Array elements; - if (!parameters.Get ("issueId", issueIdStr) || !parameters.Get ("elementsIds", elemIdsStr)) { - return CreateErrorResponse (Error, "Invalid input parameters."); - } else { - issueId = APIGuidFromString (issueIdStr.ToCStr ()); - for (ULong i = 0; i < elemIdsStr.GetSize (); ++i) { - elemIds.Push (APIGuidFromString (elemIdsStr[i].ToCStr ())); - } + if (!parameters.Get ("issueId", issueId) || !parameters.Get ("elements", elements)) { + return CreateFailedExecutionResult (Error, "Invalid input parameters."); } + const GS::Array elemIds = elements.Transform (GetGuidFromElementsArrayItem); + GSErrCode err = ACAPI_CallUndoableCommand ("Detach elements", [&]() -> GSErrCode { - err = ACAPI_Markup_DetachElements (issueId, elemIds); - return err; + return ACAPI_Markup_DetachElements (GetGuidFromObjectState (issueId), elemIds); }); - return {}; + if (err != NoError) { + return CreateFailedExecutionResult (Error, "Failed to detach elements."); + } + + return CreateSuccessfulExecutionResult (); } GetElementsAttachedToIssueCommand::GetElementsAttachedToIssueCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -608,12 +651,10 @@ GS::Optional GetElementsAttachedToIssueCommand::GetInputParameter "type": "object", "properties": { "issueId": { - "type": "string", - "description": "The id of the issue to get elements." + "$ref": "#/IssueId" }, "type": { - "type": "integer", - "description": "The attachment type to filter elements." + "$ref": "#/IssueElementType" } }, "additionalProperties": false, @@ -633,7 +674,7 @@ GS::Optional GetElementsAttachedToIssueCommand::GetResponseSchema "$ref": "#/Elements" } }, - "additionalProperties": false, + "additionalProperties": true, "required": [ "elements" ] @@ -642,35 +683,32 @@ GS::Optional GetElementsAttachedToIssueCommand::GetResponseSchema GS::ObjectState GetElementsAttachedToIssueCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { - int type; - GS::ObjectState response; - GS::Array elemIds; - GS::UniString issueIdStr; + GS::UniString type; + GS::ObjectState issueId; - parameters.Get ("type", type); - if (!parameters.Get ("issueId", issueIdStr) || !(type >= 0 && type <= 3)) { - return CreateErrorResponse (Error, "Invalid input parameters."); + if (!parameters.Get ("type", type) || !parameters.Get ("issueId", issueId)) { + return CreateErrorResponse (APIERR_BADPARS, "Invalid input parameters."); } - API_Guid issueId = APIGuidFromString (issueIdStr.ToCStr ()); - GSErrCode err = TAPIR_MarkUp_GetAttachedElements (issueId, type, elemIds); - const auto& elemObj = response.AddList ("elements"); + GS::ObjectState response; + GS::Array attachedElements; - if (err == NoError) { - elemIds.Enumerate ([&elemObj](const API_Guid& guid) { - GS::ObjectState elements; - elements.Add ("guid", APIGuidToString (guid)); - elemObj (elements); - }); - } else { + GSErrCode err = TAPIR_MarkUp_GetAttachedElements (GetGuidFromObjectState (issueId), ConvertStringToMarkUpComponentTypeID (type), attachedElements); + const auto& elements = response.AddList ("elements"); + + if (err != NoError) { return CreateErrorResponse (err, "Failed to retrieve attached elements."); } + for (const API_Guid& guid : attachedElements) { + elements (CreateElementIdObjectState (guid)); + } + return response; } ExportIssuesToBCFCommand::ExportIssuesToBCFCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -684,13 +722,9 @@ GS::Optional ExportIssuesToBCFCommand::GetInputParametersSchema ( return R"({ "type": "object", "properties": { - "issuesIds": { - "type": "array", - "description": "Issue Ids to export.", - "items": { - "type": "string" - }, - "minItems": 1 + "issues": { + "$ref": "#/Issues", + "description": "Leave it empty to export all issues." }, "exportPath": { "type": "string", @@ -714,45 +748,50 @@ GS::Optional ExportIssuesToBCFCommand::GetInputParametersSchema ( })"; } +GS::Optional ExportIssuesToBCFCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + GS::ObjectState ExportIssuesToBCFCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { GS::UniString exportPath; - GS::Array issueIdsStr; + GS::Array issues; GS::Array issueIds; - GS::Array issues; bool useExternalId = false; bool alignBySurveyPoint = true; if (!parameters.Get ("exportPath", exportPath) || !parameters.Get ("useExternalId", useExternalId) || !parameters.Get ("alignBySurveyPoint", alignBySurveyPoint)) { - return CreateErrorResponse (Error, "Invalid input parameters."); + return CreateFailedExecutionResult (Error, "Invalid input parameters."); } - parameters.Get ("issuesIds", issueIdsStr); - if (issueIdsStr.IsEmpty ()) { + parameters.Get ("issues", issues); + if (issues.IsEmpty ()) { + GS::Array issues; GSErrCode err = ACAPI_Markup_GetList (APINULLGuid, &issues); if (err == NoError) { - for (const auto& issues : issues) { - issueIds.Push (issues.guid); + for (const auto& i : issues) { + issueIds.Push (i.guid); } } } else { - for (ULong i = 0; i < issueIdsStr.GetSize (); ++i) { - issueIds.Push (APIGuidFromString (issueIdsStr[i].ToCStr ())); - } + issueIds = issues.Transform (GetGuidFromIssuesArrayItem); } IO::Location bcfFilePath (exportPath); GSErrCode err = ACAPI_Markup_ExportToBCF (bcfFilePath, issueIds, useExternalId, alignBySurveyPoint); if (err != NoError) { - return CreateErrorResponse (err, "Failed to export issues."); + return CreateFailedExecutionResult (err, "Failed to export issues."); } - return {}; + return CreateSuccessfulExecutionResult (); } ImportIssuesFromBCFCommand::ImportIssuesFromBCFCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -783,25 +822,31 @@ GS::Optional ImportIssuesFromBCFCommand::GetInputParametersSchema })"; } +GS::Optional ImportIssuesFromBCFCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + GS::ObjectState ImportIssuesFromBCFCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const { bool alignBySurveyPoint = true; GS::UniString importPath; if (!parameters.Get ("importPath", importPath) || !parameters.Get ("alignBySurveyPoint", alignBySurveyPoint)) { - return CreateErrorResponse (Error, "Invalid input parameters."); + return CreateFailedExecutionResult (Error, "Invalid input parameters."); } IO::Location bcfFilePath (importPath); GSErrCode err = ACAPI_CallUndoableCommand ("Import BCF Issues", [&]() -> GSErrCode { API_IFCRelationshipData ifcRelationshipData = GetCurrentProjectIFCRelationshipData (); - err = ACAPI_Markup_ImportFromBCF (bcfFilePath, true, &GetIFCRelationshipData, &ifcRelationshipData, false, alignBySurveyPoint); - return err; + return ACAPI_Markup_ImportFromBCF (bcfFilePath, true, &GetIFCRelationshipData, &ifcRelationshipData, false, alignBySurveyPoint); }); if (err != NoError) { - return CreateErrorResponse (err, "Failed to import issues."); + return CreateFailedExecutionResult (err, "Failed to import issues."); } - return {}; + return CreateSuccessfulExecutionResult (); } \ No newline at end of file diff --git a/archicad-addon/Sources/IssueCommands.hpp b/archicad-addon/Sources/IssueCommands.hpp index 4f99331..e41c983 100644 --- a/archicad-addon/Sources/IssueCommands.hpp +++ b/archicad-addon/Sources/IssueCommands.hpp @@ -8,6 +8,7 @@ class CreateIssueCommand : public CommandBase CreateIssueCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; @@ -17,6 +18,7 @@ class DeleteIssueCommand : public CommandBase DeleteIssueCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; @@ -35,6 +37,7 @@ class AddCommentToIssueCommand : public CommandBase AddCommentToIssueCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; @@ -54,6 +57,7 @@ class AttachElementsToIssueCommand : public CommandBase AttachElementsToIssueCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; @@ -63,6 +67,7 @@ class DetachElementsFromIssueCommand : public CommandBase DetachElementsFromIssueCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; @@ -82,6 +87,7 @@ class ExportIssuesToBCFCommand : public CommandBase ExportIssuesToBCFCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; @@ -91,5 +97,6 @@ class ImportIssuesFromBCFCommand : public CommandBase ImportIssuesFromBCFCommand (); virtual GS::String GetName () const override; virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; \ No newline at end of file diff --git a/archicad-addon/Sources/LibraryCommands.cpp b/archicad-addon/Sources/LibraryCommands.cpp index 46b33c3..488be15 100644 --- a/archicad-addon/Sources/LibraryCommands.cpp +++ b/archicad-addon/Sources/LibraryCommands.cpp @@ -81,13 +81,12 @@ GS::ObjectState GetLibrariesCommand::Execute (const GS::ObjectState& /*parameter GS::ObjectState response; const auto& listAdder = response.AddList ("libraries"); - for (UInt32 i = 0; i < libs.GetSize (); i++) { - + for (const API_LibraryInfo& lib : libs) { GS::ObjectState libraryData; GS::UniString type; GS::UniString twServerUrl; GS::UniString urlWebLibrary; - switch (libs[i].libraryType) { + switch (lib.libraryType) { case API_LibraryTypeID::API_Undefined: type = "Undefined"; break; @@ -96,7 +95,7 @@ GS::ObjectState GetLibrariesCommand::Execute (const GS::ObjectState& /*parameter break; case API_LibraryTypeID::API_UrlLibrary: type = "UrlLibrary"; - urlWebLibrary = libs[i].twServerUrl; + urlWebLibrary = lib.twServerUrl; break; case API_LibraryTypeID::API_BuiltInLibrary: type = "BuiltInLibrary"; @@ -109,19 +108,19 @@ GS::ObjectState GetLibrariesCommand::Execute (const GS::ObjectState& /*parameter break; case API_LibraryTypeID::API_UrlOtherObject: type = "UrlOtherObject"; - urlWebLibrary = libs[i].twServerUrl; + urlWebLibrary = lib.twServerUrl; break; case API_LibraryTypeID::API_ServerLibrary: type = "ServerLibrary"; - twServerUrl = libs[i].twServerUrl; + twServerUrl = lib.twServerUrl; break; } - libraryData.Add ("name", libs[i].name); - libraryData.Add ("path", libs[i].location.ToDisplayText ()); + libraryData.Add ("name", lib.name); + libraryData.Add ("path", lib.location.ToDisplayText ()); libraryData.Add ("type", type); - libraryData.Add ("available", libs[i].available); - libraryData.Add ("readOnly", libs[i].readOnly); + libraryData.Add ("available", lib.available); + libraryData.Add ("readOnly", lib.readOnly); libraryData.Add ("twServerUrl", twServerUrl); libraryData.Add ("urlWebLibrary", urlWebLibrary); listAdder (libraryData); @@ -131,7 +130,7 @@ GS::ObjectState GetLibrariesCommand::Execute (const GS::ObjectState& /*parameter } ReloadLibrariesCommand::ReloadLibrariesCommand () : - CommandBase (CommonSchema::NotUsed) + CommandBase (CommonSchema::Used) { } @@ -140,12 +139,19 @@ GS::String ReloadLibrariesCommand::GetName () const return "ReloadLibraries"; } +GS::Optional ReloadLibrariesCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + GS::ObjectState ReloadLibrariesCommand::Execute (const GS::ObjectState& /*parameters*/, GS::ProcessControl& /*processControl*/) const { GSErrCode err = ACAPI_ProjectOperation_ReloadLibraries (); if (err != NoError) { - return CreateErrorResponse (err, "Failed to reload libraries."); + return CreateFailedExecutionResult (err, "Failed to reload libraries."); } - return {}; + return CreateSuccessfulExecutionResult (); } diff --git a/archicad-addon/Sources/LibraryCommands.hpp b/archicad-addon/Sources/LibraryCommands.hpp index 1807f76..46eff5a 100644 --- a/archicad-addon/Sources/LibraryCommands.hpp +++ b/archicad-addon/Sources/LibraryCommands.hpp @@ -16,5 +16,6 @@ class ReloadLibrariesCommand : public CommandBase public: ReloadLibrariesCommand (); virtual GS::String GetName () const override; + virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; \ No newline at end of file diff --git a/archicad-addon/Sources/MigrationHelper.hpp b/archicad-addon/Sources/MigrationHelper.hpp index af930b6..b49085a 100644 --- a/archicad-addon/Sources/MigrationHelper.hpp +++ b/archicad-addon/Sources/MigrationHelper.hpp @@ -2,6 +2,12 @@ #include "ACAPinc.h" +#ifdef ServerMainVers_2800 + #define CaseInsensitive GS::CaseInsensitive +#else + #define CaseInsensitive GS::UniString::CaseInsensitive +#endif + #ifndef ServerMainVers_2700 #define ACAPI_MenuItem_RegisterMenu ACAPI_Register_Menu @@ -28,6 +34,8 @@ #define ACAPI_UserInput_SetElementHighlight ACAPI_Interface_SetElementHighlight #define ACAPI_UserInput_ClearElementHighlight ACAPI_Interface_ClearElementHighlight +#define ACAPI_Selection_Select ACAPI_Element_Select + inline API_AttributeIndex ACAPI_CreateAttributeIndex (Int32 index) { return index; @@ -54,6 +62,11 @@ inline GSErrCode ACAPI_ProjectOperation_Publish (const API_PublishPars* publishP return ACAPI_Automate (APIDo_PublishID, (void*) publishPars, (void*) selectedLinks); } +inline GSErrCode ACAPI_ProjectOperation_Open (const API_FileOpenPars * fileOpenPars) +{ + return ACAPI_Automate (APIDo_OpenID, (void*) fileOpenPars); +} + inline GSErrCode ACAPI_AutoText_GetAutoTexts (GS::Array>* autotexts, API_AutotextType autotextType) { return ACAPI_Goodies (APIAny_GetAutoTextsID, autotexts, (void*) (GS::IntPtr) autotextType); @@ -173,29 +186,50 @@ inline GSErrCode ACAPI_MarkUp_ImportFromBCF (const IO::Location& bcfFileLoc, con TAPIR_ index should distinguish the overriden ones from GS vanilla's API. */ -inline GSErrCode TAPIR_MarkUp_AttachElements (const API_Guid& issueId, const GS::Array& elemIds, int type) +#ifndef ServerMainVers_2600 +typedef enum { + APIMarkUpComponent_Creation = 0, + APIMarkUpComponent_Highlight, + APIMarkUpComponent_Deletion, + APIMarkUpComponent_Modification +} API_MarkUpComponentTypeID; + +static bool IsMarkUpComponentShowsAsCorrected (API_MarkUpComponentTypeID type) +{ + bool asCorrected = false; + switch (type) { + case APIMarkUpComponent_Creation: + case APIMarkUpComponent_Highlight: + case APIMarkUpComponent_Deletion: + asCorrected = false; + break; + case APIMarkUpComponent_Modification: + asCorrected = true; + break; + } + return asCorrected; +} +#endif + +inline GSErrCode TAPIR_MarkUp_AttachElements (const API_Guid& issueId, const GS::Array& elemIds, API_MarkUpComponentTypeID type) { #ifdef ServerMainVers_2600 - API_MarkUpComponentTypeID cType = static_cast(type); - return ACAPI_Markup_AttachElements (issueId, elemIds, cType); + return ACAPI_Markup_AttachElements (issueId, elemIds, type); #else - int cType[] = { 0, 0, 0, 1 }; // AC25: corrected / highlighted - return ACAPI_Markup_AttachElements (issueId, elemIds, cType[type]); + return ACAPI_Markup_AttachElements (issueId, elemIds, IsMarkUpComponentShowsAsCorrected (type)); #endif } -inline GSErrCode TAPIR_MarkUp_GetAttachedElements (API_Guid issueId, int attachType, GS::Array& elemIds) +inline GSErrCode TAPIR_MarkUp_GetAttachedElements (API_Guid issueId, API_MarkUpComponentTypeID attachType, GS::Array& elemIds) { GSErrCode err; #ifdef ServerMainVers_2600 - API_MarkUpComponentTypeID elemType = static_cast(attachType); - err = ACAPI_Markup_GetAttachedElements (issueId, elemType, elemIds); + err = ACAPI_Markup_GetAttachedElements (issueId, attachType, elemIds); #else - GS::Array> elemTypes; - elemTypes.SetSize (4); - err = ACAPI_Markup_GetAttachedElements (issueId, &elemTypes[3], &elemTypes[1]); - elemIds = elemTypes[attachType]; + GS::Array correctedElements; + GS::Array highlightedElements; + err = ACAPI_Markup_GetAttachedElements (issueId, &correctedElements, &highlightedElements); + elemIds = IsMarkUpComponentShowsAsCorrected (attachType) ? correctedElements : highlightedElements; #endif return err; - } \ No newline at end of file diff --git a/archicad-addon/Sources/ProjectCommands.cpp b/archicad-addon/Sources/ProjectCommands.cpp index 9ae511f..5b00544 100644 --- a/archicad-addon/Sources/ProjectCommands.cpp +++ b/archicad-addon/Sources/ProjectCommands.cpp @@ -486,4 +486,74 @@ GS::ObjectState GetStoryInfoCommand::Execute (const GS::ObjectState& /*parameter } return response; +} + +OpenProjectCommand::OpenProjectCommand () : + CommandBase (CommonSchema::Used) +{ +} + +GS::String OpenProjectCommand::GetName () const +{ + return "OpenProject"; +} + +GS::Optional OpenProjectCommand::GetInputParametersSchema () const +{ + return R"({ + "type": "object", + "properties": { + "projectFilePath": { + "type": "string", + "description": "The target project file to open." + } + }, + "additionalProperties": false, + "required": [ + "projectFilePath" + ] + })"; +} + +GS::Optional OpenProjectCommand::GetResponseSchema () const +{ + return R"({ + "$ref": "#/ExecutionResult" + })"; +} + +GS::ObjectState OpenProjectCommand::Execute (const GS::ObjectState& parameters, GS::ProcessControl& /*processControl*/) const +{ + GS::UniString projectFilePath; + if (!parameters.Get ("projectFilePath", projectFilePath)) { + return CreateFailedExecutionResult (APIERR_BADPARS, "projectFilePath parameter is missing"); + } + + IO::Location projectLocation (projectFilePath); + IO::Name lastLocalName; + if (projectLocation.GetLastLocalName (&lastLocalName) != NoError) { + return CreateFailedExecutionResult (APIERR_BADPARS, "projectFilePath parameter is invalid"); + } + + const GS::UniString extension = lastLocalName.GetExtension (); + API_FileOpenPars openPars = {}; + if (extension.Compare ("pln", CaseInsensitive) == GS::UniString::Equal) { + openPars.fileTypeID = APIFType_PlanFile; + } else if (extension.Compare ("pla", CaseInsensitive) == GS::UniString::Equal) { + openPars.fileTypeID = APIFType_A_PlanFile; + } else { + return CreateFailedExecutionResult (APIERR_BADPARS, "projectFilePath parameter is invalid, the extension must be pln or pla"); + } + + openPars.libGiven = false; + openPars.useStoredLib = true; + openPars.enableSaveAlert = false; + openPars.file = &projectLocation; + + const GSErrCode err = ACAPI_ProjectOperation_Open (&openPars); + if (err != NoError) { + return CreateFailedExecutionResult (err, "Failed to open the given project"); + } + + return CreateSuccessfulExecutionResult (); } \ No newline at end of file diff --git a/archicad-addon/Sources/ProjectCommands.hpp b/archicad-addon/Sources/ProjectCommands.hpp index bca58aa..184ad75 100644 --- a/archicad-addon/Sources/ProjectCommands.hpp +++ b/archicad-addon/Sources/ProjectCommands.hpp @@ -55,3 +55,13 @@ class GetStoryInfoCommand : public CommandBase virtual GS::Optional GetResponseSchema () const override; virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; }; + +class OpenProjectCommand : public CommandBase +{ +public: + OpenProjectCommand (); + virtual GS::String GetName () const override; + virtual GS::Optional GetInputParametersSchema () const override; + virtual GS::Optional GetResponseSchema () const override; + virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override; +}; \ No newline at end of file diff --git a/archicad-addon/Sources/SchemaDefinitions.cpp b/archicad-addon/Sources/SchemaDefinitions.cpp index 89cac74..0a19ded 100644 --- a/archicad-addon/Sources/SchemaDefinitions.cpp +++ b/archicad-addon/Sources/SchemaDefinitions.cpp @@ -353,6 +353,58 @@ GS::UniString GetBaseSchemaDefinitions () "Interactive Schedule", "Unknown" ] + }, + "IssueId": { + "type": "object", + "description": "The identifier of an issue.", + "properties": { + "guid": { + "$ref": "#/Guid" + } + }, + "additionalProperties": false, + "required": [ + "guid" + ] + }, + "IssueIdArrayItem": { + "type": "object", + "properties": { + "issueId": { + "$ref": "#/IssueId" + } + }, + "additionalProperties": false, + "required": [ + "issueId" + ] + }, + "Issues": { + "type": "array", + "description": "A list of Issues.", + "items": { + "$ref": "#/IssueIdArrayItem" + } + }, + "IssueElementType": { + "type": "string", + "description": "The attachment type of an element component of an issue.", + "enum": [ + "Creation", + "Highlight", + "Deletion", + "Modification" + ] + }, + "IssueCommentStatus": { + "type": "string", + "description": "The status of an issue comment.", + "enum": [ + "Error", + "Warning", + "Info", + "Unknown" + ] })"; return baseSchemaDefinitions; } diff --git a/archicad-addon/Test/.gitattributes b/archicad-addon/Test/.gitattributes new file mode 100644 index 0000000..bc6ed2d --- /dev/null +++ b/archicad-addon/Test/.gitattributes @@ -0,0 +1 @@ +*.pla filter=lfs diff=lfs merge=lfs -text diff --git a/archicad-addon/Test/ExpectedOutputs/change_gdlparameters.py.output b/archicad-addon/Test/ExpectedOutputs/change_gdlparameters.py.output new file mode 100644 index 0000000..7cd3716 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/change_gdlparameters.py.output @@ -0,0 +1,2136 @@ +Command: GetGDLParametersOfElements +Parameters: +{ + "elements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] +} +Response: +{ + "gdlParametersOfElements": [ + { + "A": { + "index": 0, + "type": "Length", + "value": 0.7 + }, + "B": { + "index": 1, + "type": "Length", + "value": 0.6 + }, + "ZZYZX": { + "index": 2, + "type": "Length", + "value": 0.8 + }, + "AC_show2DHotspotsIn3D": { + "index": 3, + "type": "Boolean", + "value": false + }, + "ac_bottomlevel": { + "index": 4, + "type": "Length", + "value": 1 + }, + "ac_toplevel": { + "index": 5, + "type": "Length", + "value": 0 + }, + "gs_seat_height": { + "index": 6, + "type": "Length", + "value": 0.45 + }, + "gs_2D_representation": { + "index": 7, + "type": "Title", + "value": "" + }, + "iDetlevel2D": { + "index": 8, + "type": "Integer", + "value": 1 + }, + "iChairSymbolType": { + "index": 9, + "type": "Integer", + "value": 4 + }, + "gs_cont_pen": { + "index": 10, + "type": "PenColor", + "value": 4 + }, + "gs_fill_type": { + "index": 11, + "type": "FillPattern", + "value": { + "index": 65, + "name": "Background" + } + }, + "gs_fill_pen": { + "index": 12, + "type": "PenColor", + "value": 19 + }, + "gs_back_pen": { + "index": 13, + "type": "PenColor", + "value": 19 + }, + "gs_min_space": { + "index": 14, + "type": "Title", + "value": "" + }, + "MSFront": { + "index": 15, + "type": "Length", + "value": 0.03 + }, + "MSSide": { + "index": 16, + "type": "Length", + "value": 0.15 + }, + "MSRear": { + "index": 17, + "type": "Length", + "value": 0.3 + }, + "gs_3D_representation": { + "index": 18, + "type": "Title", + "value": "" + }, + "iDetlevel3D": { + "index": 19, + "type": "Integer", + "value": 1 + }, + "gs_resol": { + "index": 20, + "type": "Integer", + "value": 24 + }, + "gs_shadow": { + "index": 21, + "type": "Boolean", + "value": true + }, + "gs_material": { + "index": 22, + "type": "Title", + "value": "" + }, + "gs_seat_mat": { + "index": 23, + "type": "Material", + "value": { + "index": 3, + "name": "Paint - Dark Gray" + } + }, + "gs_frame_mat": { + "index": 24, + "type": "Material", + "value": { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + }, + "gs_back_mat": { + "index": 25, + "type": "Material", + "value": { + "index": 66, + "name": "Paint - Sand Beige" + } + }, + "gs_list": { + "index": 26, + "type": "Title", + "value": "" + }, + "gs_list_cost": { + "index": 27, + "type": "RealNumber", + "value": 0 + }, + "gs_list_manufacturer": { + "index": 28, + "type": "String", + "value": "" + }, + "gs_list_note": { + "index": 29, + "type": "String", + "value": "" + }, + "gs_list_location": { + "index": 30, + "type": "String", + "value": "" + }, + "gs_list_accessories": { + "index": 31, + "type": "String", + "value": "" + }, + "FM_Type": { + "index": 32, + "type": "String", + "value": "Furniture" + }, + "iFMType": { + "index": 33, + "type": "Integer", + "value": 16 + }, + "FM_InventoryNumber": { + "index": 34, + "type": "String", + "value": "" + }, + "FM_SerialNumber": { + "index": 35, + "type": "String", + "value": "" + }, + "FM_ProductionYear": { + "index": 36, + "type": "String", + "value": "" + }, + "FM_ObjectWeight": { + "index": 37, + "type": "RealNumber", + "value": 0 + }, + "FM_ObjectWeightUnit": { + "index": 38, + "type": "String", + "value": "kg" + }, + "gs_list_custom1": { + "index": 39, + "type": "String", + "value": "" + }, + "gs_list_custom2": { + "index": 40, + "type": "String", + "value": "" + }, + "gs_list_custom3": { + "index": 41, + "type": "String", + "value": "" + }, + "gs_list_custom4": { + "index": 42, + "type": "String", + "value": "" + }, + "gs_list_custom5": { + "index": 43, + "type": "String", + "value": "" + }, + "gs_ui_current_page": { + "index": 44, + "type": "Integer", + "value": 2 + } + }, + { + "A": { + "index": 0, + "type": "Length", + "value": 0.45 + }, + "B": { + "index": 1, + "type": "Length", + "value": 0.4 + }, + "ZZYZX": { + "index": 2, + "type": "Length", + "value": 0.6 + }, + "AC_show2DHotspotsIn3D": { + "index": 3, + "type": "Boolean", + "value": false + }, + "ac_bottomlevel": { + "index": 4, + "type": "Length", + "value": 1 + }, + "ac_toplevel": { + "index": 5, + "type": "Length", + "value": 0 + }, + "numDrawer": { + "index": 6, + "type": "Integer", + "value": 2 + }, + "tDoorPanel": { + "index": 7, + "type": "Title", + "value": "" + }, + "iPanelGroup": { + "index": 8, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "iPanelStyle": { + "index": 9, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "iFrameJoinery": { + "index": 10, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "iFrameBevel": { + "index": 11, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "panelFrameWidth": { + "index": 12, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.02 + ] + }, + "mullionWidth": { + "index": 13, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.01 + ] + }, + "nVerticalMullion": { + "index": 14, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "nHorizontalMullion": { + "index": 15, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "doorCustomPanelName": { + "index": 16, + "type": "String", + "dimension1": 1, + "dimension2": 1, + "value": [ + "" + ] + }, + "bKnob": { + "index": 17, + "type": "Boolean", + "value": true + }, + "iKnobGroup": { + "index": 18, + "type": "Integer", + "value": 1 + }, + "iKnobStyle": { + "index": 19, + "type": "Integer", + "value": 1 + }, + "iKnobOnSide": { + "index": 20, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "bDoubleKnob": { + "index": 21, + "type": "Boolean", + "dimension1": 1, + "dimension2": 1, + "value": [ + false + ] + }, + "iKnobOrientation": { + "index": 22, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "knobLength": { + "index": 23, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.2 + ] + }, + "knobPosDrawerX": { + "index": 24, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0 + ] + }, + "knobPosDrawerY": { + "index": 25, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0 + ] + }, + "doorCustomKnobName": { + "index": 26, + "type": "String", + "value": "" + }, + "customHandleLength": { + "index": 27, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.1 + ] + }, + "customHandleHeight": { + "index": 28, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.1 + ] + }, + "customHandleDepth": { + "index": 29, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.1 + ] + }, + "gs_2D_representation": { + "index": 30, + "type": "Title", + "value": "" + }, + "iDetlevel2D": { + "index": 31, + "type": "Integer", + "value": 1 + }, + "iSymbolStyle": { + "index": 32, + "type": "Integer", + "value": 1 + }, + "gs_cont_pen": { + "index": 33, + "type": "PenColor", + "value": 4 + }, + "gs_fill_type": { + "index": 34, + "type": "FillPattern", + "value": { + "index": 65, + "name": "Background" + } + }, + "gs_fill_pen": { + "index": 35, + "type": "PenColor", + "value": 19 + }, + "gs_back_pen": { + "index": 36, + "type": "PenColor", + "value": 19 + }, + "gs_min_space": { + "index": 37, + "type": "Title", + "value": "" + }, + "MSFront": { + "index": 38, + "type": "Length", + "value": 0.6 + }, + "gs_3D_representation": { + "index": 39, + "type": "Title", + "value": "" + }, + "iDetlevel3D": { + "index": 40, + "type": "Integer", + "value": 1 + }, + "gs_resol": { + "index": 41, + "type": "Integer", + "value": 24 + }, + "gs_shadow": { + "index": 42, + "type": "Boolean", + "value": true + }, + "tSurfaces": { + "index": 43, + "type": "Title", + "value": "" + }, + "matCabinet": { + "index": 44, + "type": "Material", + "value": { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + }, + "knobMat": { + "index": 45, + "type": "Material", + "value": { + "index": 13, + "name": "Metal - Chrome 01" + } + }, + "tPanelSurf": { + "index": 46, + "type": "Title", + "value": "" + }, + "panelFrameMat": { + "index": 47, + "type": "Material", + "dimension1": 1, + "dimension2": 1, + "value": [ + { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + ] + }, + "insetMat1": { + "index": 48, + "type": "Material", + "dimension1": 1, + "dimension2": 1, + "value": [ + { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + ] + }, + "insetMat2": { + "index": 49, + "type": "Material", + "dimension1": 1, + "dimension2": 1, + "value": [ + { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + ] + }, + "gs_list": { + "index": 50, + "type": "Title", + "value": "" + }, + "gs_list_cost": { + "index": 51, + "type": "RealNumber", + "value": 0 + }, + "gs_list_manufacturer": { + "index": 52, + "type": "String", + "value": "" + }, + "gs_list_note": { + "index": 53, + "type": "String", + "value": "" + }, + "gs_list_location": { + "index": 54, + "type": "String", + "value": "" + }, + "gs_list_accessories": { + "index": 55, + "type": "String", + "value": "" + }, + "FM_Type": { + "index": 56, + "type": "String", + "value": "Furniture" + }, + "iFMType": { + "index": 57, + "type": "Integer", + "value": 16 + }, + "FM_InventoryNumber": { + "index": 58, + "type": "String", + "value": "" + }, + "FM_SerialNumber": { + "index": 59, + "type": "String", + "value": "" + }, + "FM_ProductionYear": { + "index": 60, + "type": "String", + "value": "" + }, + "FM_ObjectWeight": { + "index": 61, + "type": "RealNumber", + "value": 0 + }, + "FM_ObjectWeightUnit": { + "index": 62, + "type": "String", + "value": "kg" + }, + "gs_list_custom1": { + "index": 63, + "type": "String", + "value": "" + }, + "gs_list_custom2": { + "index": 64, + "type": "String", + "value": "" + }, + "gs_list_custom3": { + "index": 65, + "type": "String", + "value": "" + }, + "gs_list_custom4": { + "index": 66, + "type": "String", + "value": "" + }, + "gs_list_custom5": { + "index": 67, + "type": "String", + "value": "" + }, + "gs_onorm_Title": { + "index": 68, + "type": "Title", + "value": "" + }, + "gs_onorm_dimensions": { + "index": 69, + "type": "String", + "value": "" + }, + "gs_onorm_manufacturer": { + "index": 70, + "type": "String", + "value": "" + }, + "gs_onorm_baseheight_value": { + "index": 71, + "type": "String", + "value": "" + }, + "gs_onorm_baseheight": { + "index": 72, + "type": "String", + "value": "" + }, + "gs_onorm_assemblydate": { + "index": 73, + "type": "String", + "value": "" + }, + "gs_onorm_customtext1": { + "index": 74, + "type": "String", + "value": "" + }, + "gs_onorm_customtext2": { + "index": 75, + "type": "String", + "value": "" + }, + "gs_onorm_aks": { + "index": 76, + "type": "String", + "value": "" + }, + "gs_onorm_product": { + "index": 77, + "type": "String", + "value": "" + }, + "gs_onorm_leistungbuch": { + "index": 78, + "type": "String", + "value": "" + }, + "gs_onorm_description": { + "index": 79, + "type": "String", + "value": "" + }, + "gs_onorm_number": { + "index": 80, + "type": "String", + "value": "" + }, + "gs_onorm_id": { + "index": 81, + "type": "String", + "value": "" + }, + "gs_onorm_admission": { + "index": 82, + "type": "String", + "value": "" + }, + "gs_onorm_modification": { + "index": 83, + "type": "String", + "value": "" + }, + "gs_onorm_tozonenumber": { + "index": 84, + "type": "String", + "value": "" + }, + "gs_ui_current_page": { + "index": 85, + "type": "Integer", + "value": 10 + } + }, + { + "A": { + "index": 0, + "type": "Length", + "value": 0.7 + }, + "B": { + "index": 1, + "type": "Length", + "value": 0.6 + }, + "ZZYZX": { + "index": 2, + "type": "Length", + "value": 0.8 + }, + "AC_show2DHotspotsIn3D": { + "index": 3, + "type": "Boolean", + "value": false + }, + "ac_bottomlevel": { + "index": 4, + "type": "Length", + "value": 1 + }, + "ac_toplevel": { + "index": 5, + "type": "Length", + "value": 0 + }, + "gs_seat_height": { + "index": 6, + "type": "Length", + "value": 0.45 + }, + "gs_2D_representation": { + "index": 7, + "type": "Title", + "value": "" + }, + "iDetlevel2D": { + "index": 8, + "type": "Integer", + "value": 1 + }, + "iChairSymbolType": { + "index": 9, + "type": "Integer", + "value": 4 + }, + "gs_cont_pen": { + "index": 10, + "type": "PenColor", + "value": 4 + }, + "gs_fill_type": { + "index": 11, + "type": "FillPattern", + "value": { + "index": 65, + "name": "Background" + } + }, + "gs_fill_pen": { + "index": 12, + "type": "PenColor", + "value": 19 + }, + "gs_back_pen": { + "index": 13, + "type": "PenColor", + "value": 19 + }, + "gs_min_space": { + "index": 14, + "type": "Title", + "value": "" + }, + "MSFront": { + "index": 15, + "type": "Length", + "value": 0.03 + }, + "MSSide": { + "index": 16, + "type": "Length", + "value": 0.15 + }, + "MSRear": { + "index": 17, + "type": "Length", + "value": 0.3 + }, + "gs_3D_representation": { + "index": 18, + "type": "Title", + "value": "" + }, + "iDetlevel3D": { + "index": 19, + "type": "Integer", + "value": 1 + }, + "gs_resol": { + "index": 20, + "type": "Integer", + "value": 24 + }, + "gs_shadow": { + "index": 21, + "type": "Boolean", + "value": true + }, + "gs_material": { + "index": 22, + "type": "Title", + "value": "" + }, + "gs_seat_mat": { + "index": 23, + "type": "Material", + "value": { + "index": 3, + "name": "Paint - Dark Gray" + } + }, + "gs_frame_mat": { + "index": 24, + "type": "Material", + "value": { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + }, + "gs_back_mat": { + "index": 25, + "type": "Material", + "value": { + "index": 66, + "name": "Paint - Sand Beige" + } + }, + "gs_list": { + "index": 26, + "type": "Title", + "value": "" + }, + "gs_list_cost": { + "index": 27, + "type": "RealNumber", + "value": 0 + }, + "gs_list_manufacturer": { + "index": 28, + "type": "String", + "value": "" + }, + "gs_list_note": { + "index": 29, + "type": "String", + "value": "" + }, + "gs_list_location": { + "index": 30, + "type": "String", + "value": "" + }, + "gs_list_accessories": { + "index": 31, + "type": "String", + "value": "" + }, + "FM_Type": { + "index": 32, + "type": "String", + "value": "Furniture" + }, + "iFMType": { + "index": 33, + "type": "Integer", + "value": 16 + }, + "FM_InventoryNumber": { + "index": 34, + "type": "String", + "value": "" + }, + "FM_SerialNumber": { + "index": 35, + "type": "String", + "value": "" + }, + "FM_ProductionYear": { + "index": 36, + "type": "String", + "value": "" + }, + "FM_ObjectWeight": { + "index": 37, + "type": "RealNumber", + "value": 0 + }, + "FM_ObjectWeightUnit": { + "index": 38, + "type": "String", + "value": "kg" + }, + "gs_list_custom1": { + "index": 39, + "type": "String", + "value": "" + }, + "gs_list_custom2": { + "index": 40, + "type": "String", + "value": "" + }, + "gs_list_custom3": { + "index": 41, + "type": "String", + "value": "" + }, + "gs_list_custom4": { + "index": 42, + "type": "String", + "value": "" + }, + "gs_list_custom5": { + "index": 43, + "type": "String", + "value": "" + }, + "gs_ui_current_page": { + "index": 44, + "type": "Integer", + "value": 2 + } + } + ] +} +Command: SetGDLParametersOfElements +Parameters: +{ + "elementsWithGDLParameters": [ + { + "elementId": { + "guid": "" + }, + "gdlParameters": { + "gs_cont_pen": { + "index": 10, + "type": "PenColor", + "value": 95 + } + } + }, + { + "elementId": { + "guid": "" + }, + "gdlParameters": { + "gs_cont_pen": { + "index": 33, + "type": "PenColor", + "value": 95 + } + } + }, + { + "elementId": { + "guid": "" + }, + "gdlParameters": { + "gs_cont_pen": { + "index": 10, + "type": "PenColor", + "value": 95 + } + } + } + ] +} +Response: +{ + "executionResults": [ + { + "success": true + }, + { + "success": true + }, + { + "error": { + "code": -2130312912, + "message": "Failed to change parameters of element with guid " + }, + "success": false + } + ] +} +Command: GetGDLParametersOfElements +Parameters: +{ + "elements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] +} +Response: +{ + "gdlParametersOfElements": [ + { + "A": { + "index": 0, + "type": "Length", + "value": 0.7 + }, + "B": { + "index": 1, + "type": "Length", + "value": 0.6 + }, + "ZZYZX": { + "index": 2, + "type": "Length", + "value": 0.8 + }, + "AC_show2DHotspotsIn3D": { + "index": 3, + "type": "Boolean", + "value": false + }, + "ac_bottomlevel": { + "index": 4, + "type": "Length", + "value": 1 + }, + "ac_toplevel": { + "index": 5, + "type": "Length", + "value": 0 + }, + "gs_seat_height": { + "index": 6, + "type": "Length", + "value": 0.45 + }, + "gs_2D_representation": { + "index": 7, + "type": "Title", + "value": "" + }, + "iDetlevel2D": { + "index": 8, + "type": "Integer", + "value": 1 + }, + "iChairSymbolType": { + "index": 9, + "type": "Integer", + "value": 4 + }, + "gs_cont_pen": { + "index": 10, + "type": "PenColor", + "value": 95 + }, + "gs_fill_type": { + "index": 11, + "type": "FillPattern", + "value": { + "index": 65, + "name": "Background" + } + }, + "gs_fill_pen": { + "index": 12, + "type": "PenColor", + "value": 19 + }, + "gs_back_pen": { + "index": 13, + "type": "PenColor", + "value": 19 + }, + "gs_min_space": { + "index": 14, + "type": "Title", + "value": "" + }, + "MSFront": { + "index": 15, + "type": "Length", + "value": 0.03 + }, + "MSSide": { + "index": 16, + "type": "Length", + "value": 0.15 + }, + "MSRear": { + "index": 17, + "type": "Length", + "value": 0.3 + }, + "gs_3D_representation": { + "index": 18, + "type": "Title", + "value": "" + }, + "iDetlevel3D": { + "index": 19, + "type": "Integer", + "value": 1 + }, + "gs_resol": { + "index": 20, + "type": "Integer", + "value": 24 + }, + "gs_shadow": { + "index": 21, + "type": "Boolean", + "value": true + }, + "gs_material": { + "index": 22, + "type": "Title", + "value": "" + }, + "gs_seat_mat": { + "index": 23, + "type": "Material", + "value": { + "index": 3, + "name": "Paint - Dark Gray" + } + }, + "gs_frame_mat": { + "index": 24, + "type": "Material", + "value": { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + }, + "gs_back_mat": { + "index": 25, + "type": "Material", + "value": { + "index": 66, + "name": "Paint - Sand Beige" + } + }, + "gs_list": { + "index": 26, + "type": "Title", + "value": "" + }, + "gs_list_cost": { + "index": 27, + "type": "RealNumber", + "value": 0 + }, + "gs_list_manufacturer": { + "index": 28, + "type": "String", + "value": "" + }, + "gs_list_note": { + "index": 29, + "type": "String", + "value": "" + }, + "gs_list_location": { + "index": 30, + "type": "String", + "value": "" + }, + "gs_list_accessories": { + "index": 31, + "type": "String", + "value": "" + }, + "FM_Type": { + "index": 32, + "type": "String", + "value": "Furniture" + }, + "iFMType": { + "index": 33, + "type": "Integer", + "value": 16 + }, + "FM_InventoryNumber": { + "index": 34, + "type": "String", + "value": "" + }, + "FM_SerialNumber": { + "index": 35, + "type": "String", + "value": "" + }, + "FM_ProductionYear": { + "index": 36, + "type": "String", + "value": "" + }, + "FM_ObjectWeight": { + "index": 37, + "type": "RealNumber", + "value": 0 + }, + "FM_ObjectWeightUnit": { + "index": 38, + "type": "String", + "value": "kg" + }, + "gs_list_custom1": { + "index": 39, + "type": "String", + "value": "" + }, + "gs_list_custom2": { + "index": 40, + "type": "String", + "value": "" + }, + "gs_list_custom3": { + "index": 41, + "type": "String", + "value": "" + }, + "gs_list_custom4": { + "index": 42, + "type": "String", + "value": "" + }, + "gs_list_custom5": { + "index": 43, + "type": "String", + "value": "" + }, + "gs_ui_current_page": { + "index": 44, + "type": "Integer", + "value": 2 + } + }, + { + "A": { + "index": 0, + "type": "Length", + "value": 0.45 + }, + "B": { + "index": 1, + "type": "Length", + "value": 0.4 + }, + "ZZYZX": { + "index": 2, + "type": "Length", + "value": 0.6 + }, + "AC_show2DHotspotsIn3D": { + "index": 3, + "type": "Boolean", + "value": false + }, + "ac_bottomlevel": { + "index": 4, + "type": "Length", + "value": 1 + }, + "ac_toplevel": { + "index": 5, + "type": "Length", + "value": 0 + }, + "numDrawer": { + "index": 6, + "type": "Integer", + "value": 2 + }, + "tDoorPanel": { + "index": 7, + "type": "Title", + "value": "" + }, + "iPanelGroup": { + "index": 8, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "iPanelStyle": { + "index": 9, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "iFrameJoinery": { + "index": 10, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "iFrameBevel": { + "index": 11, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "panelFrameWidth": { + "index": 12, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.02 + ] + }, + "mullionWidth": { + "index": 13, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.01 + ] + }, + "nVerticalMullion": { + "index": 14, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "nHorizontalMullion": { + "index": 15, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "doorCustomPanelName": { + "index": 16, + "type": "String", + "dimension1": 1, + "dimension2": 1, + "value": [ + "" + ] + }, + "bKnob": { + "index": 17, + "type": "Boolean", + "value": true + }, + "iKnobGroup": { + "index": 18, + "type": "Integer", + "value": 1 + }, + "iKnobStyle": { + "index": 19, + "type": "Integer", + "value": 1 + }, + "iKnobOnSide": { + "index": 20, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "bDoubleKnob": { + "index": 21, + "type": "Boolean", + "dimension1": 1, + "dimension2": 1, + "value": [ + false + ] + }, + "iKnobOrientation": { + "index": 22, + "type": "Integer", + "dimension1": 1, + "dimension2": 1, + "value": [ + 1 + ] + }, + "knobLength": { + "index": 23, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.2 + ] + }, + "knobPosDrawerX": { + "index": 24, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0 + ] + }, + "knobPosDrawerY": { + "index": 25, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0 + ] + }, + "doorCustomKnobName": { + "index": 26, + "type": "String", + "value": "" + }, + "customHandleLength": { + "index": 27, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.1 + ] + }, + "customHandleHeight": { + "index": 28, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.1 + ] + }, + "customHandleDepth": { + "index": 29, + "type": "Length", + "dimension1": 1, + "dimension2": 1, + "value": [ + 0.1 + ] + }, + "gs_2D_representation": { + "index": 30, + "type": "Title", + "value": "" + }, + "iDetlevel2D": { + "index": 31, + "type": "Integer", + "value": 1 + }, + "iSymbolStyle": { + "index": 32, + "type": "Integer", + "value": 1 + }, + "gs_cont_pen": { + "index": 33, + "type": "PenColor", + "value": 95 + }, + "gs_fill_type": { + "index": 34, + "type": "FillPattern", + "value": { + "index": 65, + "name": "Background" + } + }, + "gs_fill_pen": { + "index": 35, + "type": "PenColor", + "value": 19 + }, + "gs_back_pen": { + "index": 36, + "type": "PenColor", + "value": 19 + }, + "gs_min_space": { + "index": 37, + "type": "Title", + "value": "" + }, + "MSFront": { + "index": 38, + "type": "Length", + "value": 0.6 + }, + "gs_3D_representation": { + "index": 39, + "type": "Title", + "value": "" + }, + "iDetlevel3D": { + "index": 40, + "type": "Integer", + "value": 1 + }, + "gs_resol": { + "index": 41, + "type": "Integer", + "value": 24 + }, + "gs_shadow": { + "index": 42, + "type": "Boolean", + "value": true + }, + "tSurfaces": { + "index": 43, + "type": "Title", + "value": "" + }, + "matCabinet": { + "index": 44, + "type": "Material", + "value": { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + }, + "knobMat": { + "index": 45, + "type": "Material", + "value": { + "index": 13, + "name": "Metal - Chrome 01" + } + }, + "tPanelSurf": { + "index": 46, + "type": "Title", + "value": "" + }, + "panelFrameMat": { + "index": 47, + "type": "Material", + "dimension1": 1, + "dimension2": 1, + "value": [ + { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + ] + }, + "insetMat1": { + "index": 48, + "type": "Material", + "dimension1": 1, + "dimension2": 1, + "value": [ + { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + ] + }, + "insetMat2": { + "index": 49, + "type": "Material", + "dimension1": 1, + "dimension2": 1, + "value": [ + { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + ] + }, + "gs_list": { + "index": 50, + "type": "Title", + "value": "" + }, + "gs_list_cost": { + "index": 51, + "type": "RealNumber", + "value": 0 + }, + "gs_list_manufacturer": { + "index": 52, + "type": "String", + "value": "" + }, + "gs_list_note": { + "index": 53, + "type": "String", + "value": "" + }, + "gs_list_location": { + "index": 54, + "type": "String", + "value": "" + }, + "gs_list_accessories": { + "index": 55, + "type": "String", + "value": "" + }, + "FM_Type": { + "index": 56, + "type": "String", + "value": "Furniture" + }, + "iFMType": { + "index": 57, + "type": "Integer", + "value": 16 + }, + "FM_InventoryNumber": { + "index": 58, + "type": "String", + "value": "" + }, + "FM_SerialNumber": { + "index": 59, + "type": "String", + "value": "" + }, + "FM_ProductionYear": { + "index": 60, + "type": "String", + "value": "" + }, + "FM_ObjectWeight": { + "index": 61, + "type": "RealNumber", + "value": 0 + }, + "FM_ObjectWeightUnit": { + "index": 62, + "type": "String", + "value": "kg" + }, + "gs_list_custom1": { + "index": 63, + "type": "String", + "value": "" + }, + "gs_list_custom2": { + "index": 64, + "type": "String", + "value": "" + }, + "gs_list_custom3": { + "index": 65, + "type": "String", + "value": "" + }, + "gs_list_custom4": { + "index": 66, + "type": "String", + "value": "" + }, + "gs_list_custom5": { + "index": 67, + "type": "String", + "value": "" + }, + "gs_onorm_Title": { + "index": 68, + "type": "Title", + "value": "" + }, + "gs_onorm_dimensions": { + "index": 69, + "type": "String", + "value": "" + }, + "gs_onorm_manufacturer": { + "index": 70, + "type": "String", + "value": "" + }, + "gs_onorm_baseheight_value": { + "index": 71, + "type": "String", + "value": "" + }, + "gs_onorm_baseheight": { + "index": 72, + "type": "String", + "value": "" + }, + "gs_onorm_assemblydate": { + "index": 73, + "type": "String", + "value": "" + }, + "gs_onorm_customtext1": { + "index": 74, + "type": "String", + "value": "" + }, + "gs_onorm_customtext2": { + "index": 75, + "type": "String", + "value": "" + }, + "gs_onorm_aks": { + "index": 76, + "type": "String", + "value": "" + }, + "gs_onorm_product": { + "index": 77, + "type": "String", + "value": "" + }, + "gs_onorm_leistungbuch": { + "index": 78, + "type": "String", + "value": "" + }, + "gs_onorm_description": { + "index": 79, + "type": "String", + "value": "" + }, + "gs_onorm_number": { + "index": 80, + "type": "String", + "value": "" + }, + "gs_onorm_id": { + "index": 81, + "type": "String", + "value": "" + }, + "gs_onorm_admission": { + "index": 82, + "type": "String", + "value": "" + }, + "gs_onorm_modification": { + "index": 83, + "type": "String", + "value": "" + }, + "gs_onorm_tozonenumber": { + "index": 84, + "type": "String", + "value": "" + }, + "gs_ui_current_page": { + "index": 85, + "type": "Integer", + "value": 10 + } + }, + { + "A": { + "index": 0, + "type": "Length", + "value": 0.7 + }, + "B": { + "index": 1, + "type": "Length", + "value": 0.6 + }, + "ZZYZX": { + "index": 2, + "type": "Length", + "value": 0.8 + }, + "AC_show2DHotspotsIn3D": { + "index": 3, + "type": "Boolean", + "value": false + }, + "ac_bottomlevel": { + "index": 4, + "type": "Length", + "value": 1 + }, + "ac_toplevel": { + "index": 5, + "type": "Length", + "value": 0 + }, + "gs_seat_height": { + "index": 6, + "type": "Length", + "value": 0.45 + }, + "gs_2D_representation": { + "index": 7, + "type": "Title", + "value": "" + }, + "iDetlevel2D": { + "index": 8, + "type": "Integer", + "value": 1 + }, + "iChairSymbolType": { + "index": 9, + "type": "Integer", + "value": 4 + }, + "gs_cont_pen": { + "index": 10, + "type": "PenColor", + "value": 4 + }, + "gs_fill_type": { + "index": 11, + "type": "FillPattern", + "value": { + "index": 65, + "name": "Background" + } + }, + "gs_fill_pen": { + "index": 12, + "type": "PenColor", + "value": 19 + }, + "gs_back_pen": { + "index": 13, + "type": "PenColor", + "value": 19 + }, + "gs_min_space": { + "index": 14, + "type": "Title", + "value": "" + }, + "MSFront": { + "index": 15, + "type": "Length", + "value": 0.03 + }, + "MSSide": { + "index": 16, + "type": "Length", + "value": 0.15 + }, + "MSRear": { + "index": 17, + "type": "Length", + "value": 0.3 + }, + "gs_3D_representation": { + "index": 18, + "type": "Title", + "value": "" + }, + "iDetlevel3D": { + "index": 19, + "type": "Integer", + "value": 1 + }, + "gs_resol": { + "index": 20, + "type": "Integer", + "value": 24 + }, + "gs_shadow": { + "index": 21, + "type": "Boolean", + "value": true + }, + "gs_material": { + "index": 22, + "type": "Title", + "value": "" + }, + "gs_seat_mat": { + "index": 23, + "type": "Material", + "value": { + "index": 3, + "name": "Paint - Dark Gray" + } + }, + "gs_frame_mat": { + "index": 24, + "type": "Material", + "value": { + "index": 15, + "name": "Wood - Pine Grained Horizontal" + } + }, + "gs_back_mat": { + "index": 25, + "type": "Material", + "value": { + "index": 66, + "name": "Paint - Sand Beige" + } + }, + "gs_list": { + "index": 26, + "type": "Title", + "value": "" + }, + "gs_list_cost": { + "index": 27, + "type": "RealNumber", + "value": 0 + }, + "gs_list_manufacturer": { + "index": 28, + "type": "String", + "value": "" + }, + "gs_list_note": { + "index": 29, + "type": "String", + "value": "" + }, + "gs_list_location": { + "index": 30, + "type": "String", + "value": "" + }, + "gs_list_accessories": { + "index": 31, + "type": "String", + "value": "" + }, + "FM_Type": { + "index": 32, + "type": "String", + "value": "Furniture" + }, + "iFMType": { + "index": 33, + "type": "Integer", + "value": 16 + }, + "FM_InventoryNumber": { + "index": 34, + "type": "String", + "value": "" + }, + "FM_SerialNumber": { + "index": 35, + "type": "String", + "value": "" + }, + "FM_ProductionYear": { + "index": 36, + "type": "String", + "value": "" + }, + "FM_ObjectWeight": { + "index": 37, + "type": "RealNumber", + "value": 0 + }, + "FM_ObjectWeightUnit": { + "index": 38, + "type": "String", + "value": "kg" + }, + "gs_list_custom1": { + "index": 39, + "type": "String", + "value": "" + }, + "gs_list_custom2": { + "index": 40, + "type": "String", + "value": "" + }, + "gs_list_custom3": { + "index": 41, + "type": "String", + "value": "" + }, + "gs_list_custom4": { + "index": 42, + "type": "String", + "value": "" + }, + "gs_list_custom5": { + "index": 43, + "type": "String", + "value": "" + }, + "gs_ui_current_page": { + "index": 44, + "type": "Integer", + "value": 2 + } + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/create_building_materials.py.output b/archicad-addon/Test/ExpectedOutputs/create_building_materials.py.output new file mode 100644 index 0000000..6990833 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/create_building_materials.py.output @@ -0,0 +1,437 @@ +Command: CreateBuildingMaterials +Parameters: +{ + "buildingMaterialDataArray": [ + { + "name": "New Building Material 1", + "id": "1", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 1, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 2", + "id": "2", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 2, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 3", + "id": "3", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 3, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 4", + "id": "4", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 4, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 5", + "id": "5", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 5, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 6", + "id": "6", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 6, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 7", + "id": "7", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 7, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 8", + "id": "8", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 8, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 9", + "id": "9", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 9, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + }, + { + "name": "New Building Material 10", + "id": "10", + "manufacturer": "Tapir", + "description": "This is an example Building Material", + "connPriority": 10, + "cutFillIndex": 1, + "cutFillPen": 2, + "cutFillBackgroundPen": 3, + "cutSurfaceIndex": 4, + "thermalConductivity": 1.0, + "density": 2.0, + "heatCapacity": 3.0, + "embodiedEnergy": 4.0, + "embodiedCarbon": 5.0 + } + ], + "overwriteExisting": true +} +Response: +{ + "attributeIds": [ + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + } + ] +} +New building materials: +{ + "attributes": [ + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 1", + "id": "1", + "connectionPriority": 1, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 2", + "id": "2", + "connectionPriority": 2, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 3", + "id": "3", + "connectionPriority": 3, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 4", + "id": "4", + "connectionPriority": 4, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 5", + "id": "5", + "connectionPriority": 5, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 6", + "id": "6", + "connectionPriority": 6, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 7", + "id": "7", + "connectionPriority": 7, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 8", + "id": "8", + "connectionPriority": 8, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 9", + "id": "9", + "connectionPriority": 9, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + }, + { + "buildingMaterialAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Building Material 10", + "id": "10", + "connectionPriority": 10, + "cutFillId": { + "attributeId": { + "guid": "" + } + }, + "cutFillPenIndex": 2, + "cutSurfaceId": { + "attributeId": { + "guid": "" + } + } + } + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/create_composites.py.output b/archicad-addon/Test/ExpectedOutputs/create_composites.py.output new file mode 100644 index 0000000..cddd3b9 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/create_composites.py.output @@ -0,0 +1,191 @@ +Command: CreateComposites +Parameters: +{ + "compositeDataArray": [ + { + "name": "New Composite", + "useWith": [ + "Wall", + "Shell" + ], + "skins": [ + { + "type": "Core", + "buildingMaterialId": { + "attributeId": { + "guid": "" + } + }, + "framePen": 1, + "thickness": 0.1 + }, + { + "type": "Other", + "buildingMaterialId": { + "attributeId": { + "guid": "" + } + }, + "framePen": 1, + "thickness": 0.2 + }, + { + "type": "Finish", + "buildingMaterialId": { + "attributeId": { + "guid": "" + } + }, + "framePen": 1, + "thickness": 0.3 + } + ], + "separators": [ + { + "lineTypeId": { + "attributeId": { + "guid": "" + } + }, + "linePen": 1 + }, + { + "lineTypeId": { + "attributeId": { + "guid": "" + } + }, + "linePen": 2 + }, + { + "lineTypeId": { + "attributeId": { + "guid": "" + } + }, + "linePen": 3 + }, + { + "lineTypeId": { + "attributeId": { + "guid": "" + } + }, + "linePen": 4 + } + ] + } + ], + "overwriteExisting": true +} +Response: +{ + "attributeIds": [ + { + "attributeId": { + "guid": "" + } + } + ] +} +New composite: +{ + "attributes": [ + { + "compositeAttribute": { + "attributeId": { + "guid": "" + }, + "name": "New Composite", + "totalThickness": 0.6, + "compositeSkins": [ + { + "compositeSkin": { + "buildingMaterialId": { + "attributeId": { + "guid": "" + } + }, + "framePenIndex": 1, + "thickness": 0.1, + "isCore": true, + "isFinish": false + } + }, + { + "compositeSkin": { + "buildingMaterialId": { + "attributeId": { + "guid": "" + } + }, + "framePenIndex": 1, + "thickness": 0.2, + "isCore": false, + "isFinish": false + } + }, + { + "compositeSkin": { + "buildingMaterialId": { + "attributeId": { + "guid": "" + } + }, + "framePenIndex": 1, + "thickness": 0.3, + "isCore": false, + "isFinish": true + } + } + ], + "compositeLines": [ + { + "compositeLine": { + "lineId": { + "attributeId": { + "guid": "" + } + }, + "linePenIndex": 1 + } + }, + { + "compositeLine": { + "lineId": { + "attributeId": { + "guid": "" + } + }, + "linePenIndex": 2 + } + }, + { + "compositeLine": { + "lineId": { + "attributeId": { + "guid": "" + } + }, + "linePenIndex": 3 + } + }, + { + "compositeLine": { + "lineId": { + "attributeId": { + "guid": "" + } + }, + "linePenIndex": 4 + } + } + ], + "useWith": [ + "Wall", + "Shell" + ] + } + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/filter_elements.py.output b/archicad-addon/Test/ExpectedOutputs/filter_elements.py.output new file mode 100644 index 0000000..bff46ba --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/filter_elements.py.output @@ -0,0 +1,157 @@ +------------------------------ +All elements = 13 +------------------------------ +Wall = 3 +Column = 2 +Beam = 2 +Object = 3 +CurtainWall = 1 +Stair = 1 +Railing = 1 +------------------------------ +IsEditable = 12 +IsVisibleByLayer = 12 +IsVisibleByRenovation = 11 +IsVisibleByStructureDisplay = 13 +IsVisibleIn3D = 10 +OnActualFloor = 11 +OnActualLayout = 13 +InMyWorkspace = 13 +IsIndependent = 13 +InCroppedView = 13 +HasAccessRight = 13 +IsOverriddenByRenovation = 0 +------------------------------ +IsEditable|IsVisibleByLayer = 12 +IsEditable|IsVisibleByRenovation = 10 +IsEditable|IsVisibleByStructureDisplay = 12 +IsEditable|IsVisibleIn3D = 10 +IsEditable|OnActualFloor = 10 +IsEditable|OnActualLayout = 12 +IsEditable|InMyWorkspace = 12 +IsEditable|IsIndependent = 12 +IsEditable|InCroppedView = 12 +IsEditable|HasAccessRight = 12 +IsEditable|IsOverriddenByRenovation = 0 +IsVisibleByLayer|IsEditable = 12 +IsVisibleByLayer|IsVisibleByRenovation = 10 +IsVisibleByLayer|IsVisibleByStructureDisplay = 12 +IsVisibleByLayer|IsVisibleIn3D = 10 +IsVisibleByLayer|OnActualFloor = 10 +IsVisibleByLayer|OnActualLayout = 12 +IsVisibleByLayer|InMyWorkspace = 12 +IsVisibleByLayer|IsIndependent = 12 +IsVisibleByLayer|InCroppedView = 12 +IsVisibleByLayer|HasAccessRight = 12 +IsVisibleByLayer|IsOverriddenByRenovation = 0 +IsVisibleByRenovation|IsEditable = 10 +IsVisibleByRenovation|IsVisibleByLayer = 10 +IsVisibleByRenovation|IsVisibleByStructureDisplay = 11 +IsVisibleByRenovation|IsVisibleIn3D = 10 +IsVisibleByRenovation|OnActualFloor = 9 +IsVisibleByRenovation|OnActualLayout = 11 +IsVisibleByRenovation|InMyWorkspace = 11 +IsVisibleByRenovation|IsIndependent = 11 +IsVisibleByRenovation|InCroppedView = 11 +IsVisibleByRenovation|HasAccessRight = 11 +IsVisibleByRenovation|IsOverriddenByRenovation = 0 +IsVisibleByStructureDisplay|IsEditable = 12 +IsVisibleByStructureDisplay|IsVisibleByLayer = 12 +IsVisibleByStructureDisplay|IsVisibleByRenovation = 11 +IsVisibleByStructureDisplay|IsVisibleIn3D = 10 +IsVisibleByStructureDisplay|OnActualFloor = 11 +IsVisibleByStructureDisplay|OnActualLayout = 13 +IsVisibleByStructureDisplay|InMyWorkspace = 13 +IsVisibleByStructureDisplay|IsIndependent = 13 +IsVisibleByStructureDisplay|InCroppedView = 13 +IsVisibleByStructureDisplay|HasAccessRight = 13 +IsVisibleByStructureDisplay|IsOverriddenByRenovation = 0 +IsVisibleIn3D|IsEditable = 10 +IsVisibleIn3D|IsVisibleByLayer = 10 +IsVisibleIn3D|IsVisibleByRenovation = 10 +IsVisibleIn3D|IsVisibleByStructureDisplay = 10 +IsVisibleIn3D|OnActualFloor = 8 +IsVisibleIn3D|OnActualLayout = 10 +IsVisibleIn3D|InMyWorkspace = 10 +IsVisibleIn3D|IsIndependent = 10 +IsVisibleIn3D|InCroppedView = 10 +IsVisibleIn3D|HasAccessRight = 10 +IsVisibleIn3D|IsOverriddenByRenovation = 0 +OnActualFloor|IsEditable = 10 +OnActualFloor|IsVisibleByLayer = 10 +OnActualFloor|IsVisibleByRenovation = 9 +OnActualFloor|IsVisibleByStructureDisplay = 11 +OnActualFloor|IsVisibleIn3D = 8 +OnActualFloor|OnActualLayout = 11 +OnActualFloor|InMyWorkspace = 11 +OnActualFloor|IsIndependent = 11 +OnActualFloor|InCroppedView = 11 +OnActualFloor|HasAccessRight = 11 +OnActualFloor|IsOverriddenByRenovation = 0 +OnActualLayout|IsEditable = 12 +OnActualLayout|IsVisibleByLayer = 12 +OnActualLayout|IsVisibleByRenovation = 11 +OnActualLayout|IsVisibleByStructureDisplay = 13 +OnActualLayout|IsVisibleIn3D = 10 +OnActualLayout|OnActualFloor = 11 +OnActualLayout|InMyWorkspace = 13 +OnActualLayout|IsIndependent = 13 +OnActualLayout|InCroppedView = 13 +OnActualLayout|HasAccessRight = 13 +OnActualLayout|IsOverriddenByRenovation = 0 +InMyWorkspace|IsEditable = 12 +InMyWorkspace|IsVisibleByLayer = 12 +InMyWorkspace|IsVisibleByRenovation = 11 +InMyWorkspace|IsVisibleByStructureDisplay = 13 +InMyWorkspace|IsVisibleIn3D = 10 +InMyWorkspace|OnActualFloor = 11 +InMyWorkspace|OnActualLayout = 13 +InMyWorkspace|IsIndependent = 13 +InMyWorkspace|InCroppedView = 13 +InMyWorkspace|HasAccessRight = 13 +InMyWorkspace|IsOverriddenByRenovation = 0 +IsIndependent|IsEditable = 12 +IsIndependent|IsVisibleByLayer = 12 +IsIndependent|IsVisibleByRenovation = 11 +IsIndependent|IsVisibleByStructureDisplay = 13 +IsIndependent|IsVisibleIn3D = 10 +IsIndependent|OnActualFloor = 11 +IsIndependent|OnActualLayout = 13 +IsIndependent|InMyWorkspace = 13 +IsIndependent|InCroppedView = 13 +IsIndependent|HasAccessRight = 13 +IsIndependent|IsOverriddenByRenovation = 0 +InCroppedView|IsEditable = 12 +InCroppedView|IsVisibleByLayer = 12 +InCroppedView|IsVisibleByRenovation = 11 +InCroppedView|IsVisibleByStructureDisplay = 13 +InCroppedView|IsVisibleIn3D = 10 +InCroppedView|OnActualFloor = 11 +InCroppedView|OnActualLayout = 13 +InCroppedView|InMyWorkspace = 13 +InCroppedView|IsIndependent = 13 +InCroppedView|HasAccessRight = 13 +InCroppedView|IsOverriddenByRenovation = 0 +HasAccessRight|IsEditable = 12 +HasAccessRight|IsVisibleByLayer = 12 +HasAccessRight|IsVisibleByRenovation = 11 +HasAccessRight|IsVisibleByStructureDisplay = 13 +HasAccessRight|IsVisibleIn3D = 10 +HasAccessRight|OnActualFloor = 11 +HasAccessRight|OnActualLayout = 13 +HasAccessRight|InMyWorkspace = 13 +HasAccessRight|IsIndependent = 13 +HasAccessRight|InCroppedView = 13 +HasAccessRight|IsOverriddenByRenovation = 0 +IsOverriddenByRenovation|IsEditable = 0 +IsOverriddenByRenovation|IsVisibleByLayer = 0 +IsOverriddenByRenovation|IsVisibleByRenovation = 0 +IsOverriddenByRenovation|IsVisibleByStructureDisplay = 0 +IsOverriddenByRenovation|IsVisibleIn3D = 0 +IsOverriddenByRenovation|OnActualFloor = 0 +IsOverriddenByRenovation|OnActualLayout = 0 +IsOverriddenByRenovation|InMyWorkspace = 0 +IsOverriddenByRenovation|IsIndependent = 0 +IsOverriddenByRenovation|InCroppedView = 0 +IsOverriddenByRenovation|HasAccessRight = 0 +------------------------------ diff --git a/archicad-addon/Test/ExpectedOutputs/get_building_material_physical_properties.py.output b/archicad-addon/Test/ExpectedOutputs/get_building_material_physical_properties.py.output new file mode 100644 index 0000000..22fe0d1 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/get_building_material_physical_properties.py.output @@ -0,0 +1,977 @@ +Command: GetBuildingMaterialPhysicalProperties +Parameters: +{ + "attributeIds": [ + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + }, + { + "attributeId": { + "guid": "" + } + } + ] +} +Response: +{ + "properties": [ + { + "properties": { + "thermalConductivity": 0.58, + "density": 1500, + "heatCapacity": 840, + "embodiedEnergy": 3, + "embodiedCarbon": 0.24 + } + }, + { + "properties": { + "thermalConductivity": 0.6, + "density": 1500, + "heatCapacity": 840, + "embodiedEnergy": 3, + "embodiedCarbon": 0.24 + } + }, + { + "properties": { + "thermalConductivity": 0.6, + "density": 1500, + "heatCapacity": 840, + "embodiedEnergy": 3, + "embodiedCarbon": 0.24 + } + }, + { + "properties": { + "thermalConductivity": 0.272, + "density": 840, + "heatCapacity": 920, + "embodiedEnergy": 4.5, + "embodiedCarbon": 0.36 + } + }, + { + "properties": { + "thermalConductivity": 0.121, + "density": 648, + "heatCapacity": 920, + "embodiedEnergy": 6, + "embodiedCarbon": 0.48 + } + }, + { + "properties": { + "thermalConductivity": 1.15, + "density": 1800, + "heatCapacity": 1000, + "embodiedEnergy": 0.74, + "embodiedCarbon": 0.107 + } + }, + { + "properties": { + "thermalConductivity": 2.3, + "density": 2300, + "heatCapacity": 1000, + "embodiedEnergy": 1.92, + "embodiedCarbon": 0.198 + } + }, + { + "properties": { + "thermalConductivity": 0.6, + "density": 1400, + "heatCapacity": 880, + "embodiedEnergy": 0.72, + "embodiedCarbon": 0.088 + } + }, + { + "properties": { + "thermalConductivity": 0.6, + "density": 1400, + "heatCapacity": 880, + "embodiedEnergy": 0.72, + "embodiedCarbon": 0.088 + } + }, + { + "properties": { + "thermalConductivity": 2.5, + "density": 2400, + "heatCapacity": 1000, + "embodiedEnergy": 2.33, + "embodiedCarbon": 0.242 + } + }, + { + "properties": { + "thermalConductivity": 2.5, + "density": 2400, + "heatCapacity": 1000, + "embodiedEnergy": 2.33, + "embodiedCarbon": 0.242 + } + }, + { + "properties": { + "thermalConductivity": 0.075, + "density": 200, + "heatCapacity": 1510, + "embodiedEnergy": 10.8, + "embodiedCarbon": 0.12 + } + }, + { + "properties": { + "thermalConductivity": 0.037, + "density": 40, + "heatCapacity": 840, + "embodiedEnergy": 14.3, + "embodiedCarbon": 1.08 + } + }, + { + "properties": { + "thermalConductivity": 0.036, + "density": 115, + "heatCapacity": 840, + "embodiedEnergy": 21.2, + "embodiedCarbon": 1.65 + } + }, + { + "properties": { + "thermalConductivity": 0.037, + "density": 40, + "heatCapacity": 840, + "embodiedEnergy": 14.3, + "embodiedCarbon": 1.08 + } + }, + { + "properties": { + "thermalConductivity": 0.032, + "density": 28, + "heatCapacity": 1450, + "embodiedEnergy": 87.4, + "embodiedCarbon": 3.42 + } + }, + { + "properties": { + "thermalConductivity": 0.04, + "density": 25, + "heatCapacity": 1400, + "embodiedEnergy": 88.7, + "embodiedCarbon": 3.53 + } + }, + { + "properties": { + "thermalConductivity": 0.033, + "density": 115, + "heatCapacity": 1030, + "embodiedEnergy": 47, + "embodiedCarbon": 1.9 + } + }, + { + "properties": { + "thermalConductivity": 0.18, + "density": 600, + "heatCapacity": 1000, + "embodiedEnergy": 8, + "embodiedCarbon": 1.2 + } + }, + { + "properties": { + "thermalConductivity": 0.5, + "density": 980, + "heatCapacity": 1800, + "embodiedEnergy": 76.7, + "embodiedCarbon": 1.93 + } + }, + { + "properties": { + "thermalConductivity": 0.23, + "density": 1100, + "heatCapacity": 1000, + "embodiedEnergy": 2.66, + "embodiedCarbon": 0.056 + } + }, + { + "properties": { + "thermalConductivity": 0.17, + "density": 1390, + "heatCapacity": 900, + "embodiedEnergy": 77.2, + "embodiedCarbon": 3.1 + } + }, + { + "properties": { + "thermalConductivity": 0.14, + "density": 500, + "heatCapacity": 2300, + "embodiedEnergy": 10, + "embodiedCarbon": 0.36 + } + }, + { + "properties": { + "thermalConductivity": 0.13, + "density": 500, + "heatCapacity": 2500, + "embodiedEnergy": 7.11, + "embodiedCarbon": 0.32 + } + }, + { + "properties": { + "thermalConductivity": 0.24, + "density": 1000, + "heatCapacity": 1600, + "embodiedEnergy": 16.8, + "embodiedCarbon": 0.87 + } + }, + { + "properties": { + "thermalConductivity": 0.18, + "density": 800, + "heatCapacity": 1700, + "embodiedEnergy": 13.8, + "embodiedCarbon": 0.92 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2000, + "heatCapacity": 800, + "embodiedEnergy": 3, + "embodiedCarbon": 0.24 + } + }, + { + "properties": { + "thermalConductivity": 1.5, + "density": 2000, + "heatCapacity": 900, + "embodiedEnergy": 6.5, + "embodiedCarbon": 0.48 + } + }, + { + "properties": { + "thermalConductivity": 0.8, + "density": 1600, + "heatCapacity": 1000, + "embodiedEnergy": 1.45, + "embodiedCarbon": 0.22 + } + }, + { + "properties": { + "thermalConductivity": 0.57, + "density": 1300, + "heatCapacity": 1000, + "embodiedEnergy": 1.8, + "embodiedCarbon": 0.13 + } + }, + { + "properties": { + "thermalConductivity": 0.25, + "density": 900, + "heatCapacity": 1000, + "embodiedEnergy": 6.75, + "embodiedCarbon": 0.39 + } + }, + { + "properties": { + "thermalConductivity": 0.25, + "density": 900, + "heatCapacity": 1000, + "embodiedEnergy": 6.75, + "embodiedCarbon": 0.39 + } + }, + { + "properties": { + "thermalConductivity": 160, + "density": 2800, + "heatCapacity": 880, + "embodiedEnergy": 155, + "embodiedCarbon": 9.16 + } + }, + { + "properties": { + "thermalConductivity": 50, + "density": 7500, + "heatCapacity": 450, + "embodiedEnergy": 25, + "embodiedCarbon": 1.21 + } + }, + { + "properties": { + "thermalConductivity": 50, + "density": 7800, + "heatCapacity": 450, + "embodiedEnergy": 20.1, + "embodiedCarbon": 1.46 + } + }, + { + "properties": { + "thermalConductivity": 60, + "density": 7800, + "heatCapacity": 460, + "embodiedEnergy": 25.1, + "embodiedCarbon": 1.66 + } + }, + { + "properties": { + "thermalConductivity": 17, + "density": 7900, + "heatCapacity": 460, + "embodiedEnergy": 56.7, + "embodiedCarbon": 6.15 + } + }, + { + "properties": { + "thermalConductivity": 110, + "density": 7200, + "heatCapacity": 380, + "embodiedEnergy": 53.1, + "embodiedCarbon": 3.09 + } + }, + { + "properties": { + "thermalConductivity": 1.7, + "density": 2200, + "heatCapacity": 1000, + "embodiedEnergy": 1.5, + "embodiedCarbon": 0.09 + } + }, + { + "properties": { + "thermalConductivity": 3.5, + "density": 2800, + "heatCapacity": 1000, + "embodiedEnergy": 2, + "embodiedCarbon": 0.13 + } + }, + { + "properties": { + "thermalConductivity": 0.17, + "density": 1390, + "heatCapacity": 900, + "embodiedEnergy": 77.2, + "embodiedCarbon": 3.1 + } + }, + { + "properties": { + "thermalConductivity": 0.15, + "density": 1.2, + "heatCapacity": 1008, + "embodiedEnergy": 0, + "embodiedCarbon": 0 + } + }, + { + "properties": { + "thermalConductivity": 0.15, + "density": 1.2, + "heatCapacity": 1008, + "embodiedEnergy": 0, + "embodiedCarbon": 0 + } + }, + { + "properties": { + "thermalConductivity": 1.4, + "density": 2200, + "heatCapacity": 1900, + "embodiedEnergy": 0.083, + "embodiedCarbon": 0.005 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2500, + "heatCapacity": 750, + "embodiedEnergy": 15, + "embodiedCarbon": 0.91 + } + }, + { + "properties": { + "thermalConductivity": 1.7, + "density": 900, + "heatCapacity": 1850, + "embodiedEnergy": 0.42, + "embodiedCarbon": 0.022 + } + }, + { + "properties": { + "thermalConductivity": 0.6, + "density": 1000, + "heatCapacity": 4200, + "embodiedEnergy": 0.01, + "embodiedCarbon": 0.001 + } + }, + { + "properties": { + "thermalConductivity": 2.3, + "density": 2200, + "heatCapacity": 1900, + "embodiedEnergy": 0.081, + "embodiedCarbon": 0.005 + } + }, + { + "properties": { + "thermalConductivity": 0.18, + "density": 700, + "heatCapacity": 1600, + "embodiedEnergy": 12.1, + "embodiedCarbon": 0.39 + } + }, + { + "properties": { + "thermalConductivity": 0.6, + "density": 1500, + "heatCapacity": 840, + "embodiedEnergy": 3, + "embodiedCarbon": 0.24 + } + }, + { + "properties": { + "thermalConductivity": 2.3, + "density": 2600, + "heatCapacity": 1000, + "embodiedEnergy": 1.7, + "embodiedCarbon": 0.095 + } + }, + { + "properties": { + "thermalConductivity": 0.216, + "density": 960, + "heatCapacity": 920, + "embodiedEnergy": 4.5, + "embodiedCarbon": 0.36 + } + }, + { + "properties": { + "thermalConductivity": 0.17, + "density": 1390, + "heatCapacity": 900, + "embodiedEnergy": 77.2, + "embodiedCarbon": 3.1 + } + }, + { + "properties": { + "thermalConductivity": 2.5, + "density": 2400, + "heatCapacity": 1000, + "embodiedEnergy": 2.33, + "embodiedCarbon": 0.242 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1.7, + "density": 900, + "heatCapacity": 1850, + "embodiedEnergy": 0.42, + "embodiedCarbon": 0.022 + } + }, + { + "properties": { + "thermalConductivity": 0.109, + "density": 600, + "heatCapacity": 920, + "embodiedEnergy": 6, + "embodiedCarbon": 0.48 + } + }, + { + "properties": { + "thermalConductivity": 0.037, + "density": 40, + "heatCapacity": 840, + "embodiedEnergy": 14.3, + "embodiedCarbon": 1.08 + } + }, + { + "properties": { + "thermalConductivity": 2.3, + "density": 2300, + "heatCapacity": 1000, + "embodiedEnergy": 1.92, + "embodiedCarbon": 0.198 + } + }, + { + "properties": { + "thermalConductivity": 0.25, + "density": 900, + "heatCapacity": 1000, + "embodiedEnergy": 6.75, + "embodiedCarbon": 0.39 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + }, + { + "properties": { + "thermalConductivity": 1, + "density": 2, + "heatCapacity": 3, + "embodiedEnergy": 4, + "embodiedCarbon": 5 + } + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/get_classifications_of_mainelements_and_subelements.py.output b/archicad-addon/Test/ExpectedOutputs/get_classifications_of_mainelements_and_subelements.py.output new file mode 100644 index 0000000..454d848 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/get_classifications_of_mainelements_and_subelements.py.output @@ -0,0 +1,2529 @@ +Command: GetSubelementsOfHierarchicalElements +Parameters: +{ + "hierarchicalElements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] +} +Response: +{ + "subelementsOfHierarchicalElements": [ + {}, + {}, + {}, + { + "columnSegments": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] + }, + { + "columnSegments": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] + }, + { + "beamSegments": [ + { + "elementId": { + "guid": "" + } + } + ] + }, + { + "beamSegments": [ + { + "elementId": { + "guid": "" + } + } + ] + }, + {}, + {}, + {}, + { + "cWallSegments": [ + { + "elementId": { + "guid": "" + } + } + ], + "cWallFrames": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "cWallPanels": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] + }, + { + "stairRisers": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "stairTreads": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "stairStructures": [ + { + "elementId": { + "guid": "" + } + } + ] + }, + { + "railingNodes": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "railingSegments": [ + { + "elementId": { + "guid": "" + } + } + ], + "railingPosts": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "railingHandrailEnds": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "railingToprailEnds": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "railingRails": [ + { + "elementId": { + "guid": "" + } + } + ], + "railingToprails": [ + { + "elementId": { + "guid": "" + } + } + ], + "railingHandrails": [ + { + "elementId": { + "guid": "" + } + } + ], + "railingInnerPosts": [ + { + "elementId": { + "guid": "" + } + } + ], + "railingBalusterSets": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "railingBalusters": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] + } + ] +} +Command: GetClassificationsOfElements +Parameters: +{ + "elements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "classificationSystemIds": [ + { + "classificationSystemId": { + "guid": "" + } + } + ] +} +Response: +{ + "elementClassifications": [ + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + } + ] +} +Command: GetClassificationsOfElements +Parameters: +{ + "elements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "classificationSystemIds": [ + { + "classificationSystemId": { + "guid": "" + } + } + ] +} +Response: +{ + "elementClassifications": [ + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + }, + { + "classificationIds": [ + { + "classificationSystemId": { + "guid": "" + }, + "classificationItemId": { + "guid": "" + } + } + ] + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/get_current_window.py.output b/archicad-addon/Test/ExpectedOutputs/get_current_window.py.output new file mode 100644 index 0000000..cc936b5 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/get_current_window.py.output @@ -0,0 +1,7 @@ +Command: GetCurrentWindowType +Parameters: +{} +Response: +{ + "currentWindowType": "FloorPlan" +} diff --git a/archicad-addon/Test/ExpectedOutputs/get_details_of_elements.py.output b/archicad-addon/Test/ExpectedOutputs/get_details_of_elements.py.output new file mode 100644 index 0000000..d00d7d7 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/get_details_of_elements.py.output @@ -0,0 +1,144 @@ +Command: GetDetailsOfElements +Parameters: +{ + "elements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] +} +Response: +{ + "detailsOfElements": [ + { + "type": "Wall", + "floorIndex": 0, + "layerIndex": 33, + "drawIndex": 7, + "details": { + "geometryType": "Straight", + "begCoordinate": { + "x": 0, + "y": 0 + }, + "endCoordinate": { + "x": 1.234, + "y": 0 + }, + "height": 3, + "bottomOffset": 0, + "offset": 0 + } + }, + { + "type": "Wall", + "floorIndex": 1, + "layerIndex": 33, + "drawIndex": 7, + "details": { + "geometryType": "Trapezoid", + "begThickness": 0.2, + "endThickness": 0.25, + "begCoordinate": { + "x": 0, + "y": 0.4 + }, + "endCoordinate": { + "x": 1.234, + "y": 0.4 + }, + "height": 2.8, + "bottomOffset": 0.2, + "offset": 0 + } + }, + { + "type": "Wall", + "floorIndex": 1, + "layerIndex": 33, + "drawIndex": 7, + "details": { + "geometryType": "Polygonal", + "polygonOutline": [ + { + "x": 1.35, + "y": 0.4 + }, + { + "x": 2.584, + "y": 0.4 + }, + { + "x": 2.584, + "y": 0.65 + }, + { + "x": 1.35, + "y": 0.6 + } + ], + "begCoordinate": { + "x": 1.35, + "y": 0.4 + }, + "endCoordinate": { + "x": 2.584, + "y": 0.4 + }, + "height": 2.5, + "bottomOffset": 0, + "offset": 0 + } + }, + { + "type": "Column", + "floorIndex": 0, + "layerIndex": 33, + "drawIndex": 7, + "details": { + "origin": { + "x": 0, + "y": 1 + }, + "height": 2.5, + "bottomOffset": 0.3 + } + }, + { + "type": "Column", + "floorIndex": 0, + "layerIndex": 33, + "drawIndex": 7, + "details": { + "origin": { + "x": 1, + "y": 1 + }, + "height": 2.8, + "bottomOffset": 0 + } + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/get_libraries.py.output b/archicad-addon/Test/ExpectedOutputs/get_libraries.py.output new file mode 100644 index 0000000..9906bf3 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/get_libraries.py.output @@ -0,0 +1,116 @@ +Command: GetLibraries +Parameters: +{} +Response: +{ + "libraries": [ + { + "name": "BuiltInLibraryParts.lcf", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\BuiltInLibraryParts.lcf", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "Collada In-Out.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Import-Export\\Collada In-Out.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "Corner Window.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Standard\\Corner Window.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "GoogleEarthConnectivity.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Import-Export\\GoogleEarthConnectivity.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "Grid Tool.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Local\\Grid Tool.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "IFC In-Out.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Import-Export\\IFC In-Out.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "Interactive Schedule.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Standard\\Interactive Schedule.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "MEP Modeler.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\MEP Modeler\\MEP Modeler.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "PointCloud_In.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Import-Export\\PointCloud_In.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "Rhino_In.apx", + "path": "C:\\Program Files\\Graphisoft\\Archicad 26\\Add-Ons\\Import-Export\\Rhino_In.apx\\rfs", + "type": "BuiltInLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "Embedded Library", + "path": "C:\\Users\\loran\\Graphisoft\\AutoSave-26\\Emb_\\content", + "type": "EmbeddedLibrary", + "available": true, + "readOnly": false, + "twServerUrl": "", + "urlWebLibrary": "" + }, + { + "name": "TestProject.pla", + "path": "c:\\Users\\loran\\GitRepos\\tapir-archicad-automation\\archicad-addon\\Test\\TestProject.pla", + "type": "LocalLibrary", + "available": true, + "readOnly": true, + "twServerUrl": "", + "urlWebLibrary": "" + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/get_selected_elements.py.output b/archicad-addon/Test/ExpectedOutputs/get_selected_elements.py.output new file mode 100644 index 0000000..2cb0fc8 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/get_selected_elements.py.output @@ -0,0 +1,80 @@ +Command: ChangeSelectionOfElements +Parameters: +{ + "addElementsToSelection": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] +} +Response: +{ + "executionResultsOfAddToSelection": [ + { + "success": true + }, + { + "success": true + }, + { + "success": true + }, + { + "success": true + }, + { + "success": true + } + ], + "executionResultsOfRemoveFromSelection": [] +} +Command: GetSelectedElements +Parameters: +{} +Response: +{ + "elements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ] +} diff --git a/archicad-addon/Test/ExpectedOutputs/highlight_elements.py.output b/archicad-addon/Test/ExpectedOutputs/highlight_elements.py.output new file mode 100644 index 0000000..d193996 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/highlight_elements.py.output @@ -0,0 +1,172 @@ +Command: HighlightElements +Parameters: +{ + "elements": [ + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + }, + { + "elementId": { + "guid": "" + } + } + ], + "highlightedColors": [ + [ + 0, + 50, + 50, + 255 + ], + [ + 30, + 50, + 50, + 255 + ], + [ + 60, + 50, + 50, + 255 + ], + [ + 90, + 50, + 50, + 255 + ], + [ + 120, + 50, + 50, + 255 + ], + [ + 150, + 50, + 50, + 255 + ], + [ + 180, + 50, + 50, + 255 + ], + [ + 210, + 50, + 50, + 255 + ], + [ + 240, + 50, + 50, + 255 + ], + [ + 15, + 50, + 50, + 255 + ], + [ + 45, + 50, + 50, + 255 + ], + [ + 75, + 50, + 50, + 255 + ], + [ + 105, + 50, + 50, + 255 + ] + ], + "wireframe3D": true, + "nonHighlightedColor": [ + 0, + 0, + 255, + 128 + ] +} +Response: +{ + "success": true +} +Command: HighlightElements +Parameters: +{ + "elements": [], + "highlightedColors": [] +} +Response: +{ + "success": true +} diff --git a/archicad-addon/Test/ExpectedOutputs/highlight_selected_elements.py.output b/archicad-addon/Test/ExpectedOutputs/highlight_selected_elements.py.output new file mode 100644 index 0000000..e9624a7 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/highlight_selected_elements.py.output @@ -0,0 +1,162 @@ +Command: HighlightElements +Parameters: +{ + "elements": [ + { + "elementId": { + "guid": "F18FA98C-BFC2-4E15-8779-3D1E77606A31" + } + }, + { + "elementId": { + "guid": "7885118B-8890-48EE-8705-1B88553FE9B3" + } + }, + { + "elementId": { + "guid": "D230A6FB-7921-48B0-96F4-E0D63E79CCB0" + } + }, + { + "elementId": { + "guid": "4BB43305-06E7-4E09-A37C-900338E103C6" + } + }, + { + "elementId": { + "guid": "74839492-8FC9-48E3-BB88-2CAEAB3BE7D1" + } + }, + { + "elementId": { + "guid": "0F1F9C73-68E1-4A30-B9F0-D9A63BE38A9F" + } + }, + { + "elementId": { + "guid": "C79034D0-563C-4CAD-AF37-3C7A117BC825" + } + }, + { + "elementId": { + "guid": "2CBC8127-952F-46C2-9728-39F96D0689E3" + } + }, + { + "elementId": { + "guid": "818CC40A-E111-4FCF-A559-45BA77D8F3B9" + } + }, + { + "elementId": { + "guid": "025CB9F8-ED73-4B0A-B1D9-C796D598C982" + } + }, + { + "elementId": { + "guid": "64FE99A9-A04A-4DAD-ADF9-79B129C62AE2" + } + }, + { + "elementId": { + "guid": "AFE9CC05-7C1D-4F70-A0AD-84B8A3405ABD" + } + }, + { + "elementId": { + "guid": "6BF6D185-8ED9-47F0-800C-F4E33AE05998" + } + } + ], + "highlightedColors": [ + [ + 0, + 50, + 50, + 255 + ], + [ + 30, + 50, + 50, + 255 + ], + [ + 60, + 50, + 50, + 255 + ], + [ + 90, + 50, + 50, + 255 + ], + [ + 120, + 50, + 50, + 255 + ], + [ + 150, + 50, + 50, + 255 + ], + [ + 180, + 50, + 50, + 255 + ], + [ + 210, + 50, + 50, + 255 + ], + [ + 240, + 50, + 50, + 255 + ], + [ + 15, + 50, + 50, + 255 + ], + [ + 45, + 50, + 50, + 255 + ], + [ + 75, + 50, + 50, + 255 + ], + [ + 105, + 50, + 50, + 255 + ] + ], + "wireframe3D": true, + "nonHighlightedColor": [ + 0, + 0, + 255, + 128 + ] +} +Response: +{ + "success": true +} diff --git a/archicad-addon/Test/ExpectedOutputs/issue_management.py.output b/archicad-addon/Test/ExpectedOutputs/issue_management.py.output new file mode 100644 index 0000000..2aa9bc0 --- /dev/null +++ b/archicad-addon/Test/ExpectedOutputs/issue_management.py.output @@ -0,0 +1,469 @@ +Command: CreateIssue +Parameters: +{ + "name": "Just a sample issue", + "tagText": "python" +} +Response: +{ + "issueId": { + "guid": "" + } +} +Command: CreateIssue +Parameters: +{ + "name": "Just a sample issue #2", + "tagText": "python #2" +} +Response: +{ + "issueId": { + "guid": "" + } +} +Command: GetIssues +Parameters: +{} +Response: +{ + "issues": [ + { + "issueId": { + "guid": "" + }, + "name": "Just a sample issue", + "parentIssueId": { + "guid": "" + }, + "creaTime":