Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in HighlightElements #174

Open
runxel opened this issue Sep 14, 2024 · 5 comments
Open

Exception in HighlightElements #174

runxel opened this issue Sep 14, 2024 · 5 comments

Comments

@runxel
Copy link

runxel commented Sep 14, 2024

I was checking out issue #87 and tried out the code there, but it fails with an exception raised:

File "/Users/runxel/dev/tapir-archicad-automation/python_package/src/tapir_py/core.py", line 270, in HighlightElements
    raise Exception("Script Error")
Exception: Script Error

The error message is not helpful, but I think it's not in the Python package (used the latest code cloned from here).

@tlorantfy
Copy link
Collaborator

The input parameters of HighlightElements command was changed since issue #87 was created.
So the attached code in #87 does not work anymore, it results error.
'python_package/src/tapir_py/core.py' must be updated accordingly => its a bug in python package

Note, using the updated command we can use multiple colors for elements, so elements can be highlighted with different colors.

Please find working example scripts at https://github.com/ENZYME-APD/tapir-archicad-automation/blob/main/archicad-addon/Examples
An example script for HighlightElements command:
https://github.com/ENZYME-APD/tapir-archicad-automation/blob/main/archicad-addon/Examples/highlight_elements.py

@runxel
Copy link
Author

runxel commented Sep 14, 2024

Thank you for clarifying what I already suspected.
However the example script is not working for me either:

Command: HighlightElements
Parameters:
{
    "elements": [],
    "highlightedColors": [],
    "wireframe3D": true,
    "nonHighlightedColor": [
        0,
        0,
        255,
        128
    ]
}
Error:
{
    "code": 4010,
    "message": "Archicad does not have the registered Add-On command with the name : TapirCommand.HighlightElements"
}
Response:
null
Traceback (most recent call last):
  File "/Users/runxel/dev/tapir-archicad-automation/archicad-addon/Examples/highlight_elements.py", line 15, in <module>
    response = aclib.RunTapirCommand (commandName, commandParameters)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runxel/dev/tapir-archicad-automation/archicad-addon/Examples/aclib/__init__.py", line 45, in RunTapirCommand
    if 'error' in result:
       ^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Uhhh, what now? 😅

@tlorantfy
Copy link
Collaborator

The error message is clear, Archicad does not find TapirCommand.HighlightElements command.
Please make sure Tapir Add-On is loaded, you can check it in Add-On Manager (find it in Options menu).

The documentation says HighlightElements command is available from version 1.0.3.

image

@runxel
Copy link
Author

runxel commented Sep 15, 2024

Okay maybe I was not clear enough, sorry Tibor.
What I meant was: The error message does not make sense since Tapir is in fact installed. So now you understand my confusion.
Somewhat else is in play here, but I can't see what.

@kovacsv
Copy link
Collaborator

kovacsv commented Sep 15, 2024

Only one thing comes to my mind: is it possible that multiple Archicad instances are running on your computer? Example scripts will find the one that is started first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants