-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* More uniform schema for commands * New commands: OpenProject, ChangeSelectionOfElements * Autotest framework for examples * Fixing examples and prepare them for test environment * Expected outputs * Store TestProject.pla using Git LFS * Update documentation
- Loading branch information
Showing
67 changed files
with
10,565 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Build/* | ||
Test/TestProject* | ||
!Test/TestProject.pla | ||
.DS_Store | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']))) | ||
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) |
16 changes: 2 additions & 14 deletions
16
archicad-addon/Examples/get_building_material_physical_properties.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' })) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
import aclib | ||
import json | ||
|
||
response = aclib.RunTapirCommand ('GetCurrentWindowType', {}) | ||
|
||
print (json.dumps (response['currentWindowType'], indent = 4)) | ||
response = aclib.RunTapirCommand ('GetCurrentWindowType', {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}) |
24 changes: 0 additions & 24 deletions
24
archicad-addon/Examples/get_details_of_selected_elements.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' : [], | ||
}) |
Oops, something went wrong.