pyrevitlabs/pyRevit

[Bug]: Find And Select Entities Without Tags Error

JerryWu25 opened this issue · 2 comments

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

Used the Find And Select Entities Without Tags for walls in a plan view, got the error as below

⌨ Error/Debug Message

IronPython Traceback:
Traceback (most recent call last):
 File "C:\PyRevit-Master\PyRevit\extensions\pyRevitTools.extension\pyRevit.tab\Selection.panel\select.stack\Select.pulldown\Find And Select Entities Without Tags.pushbutton\script.py", line 243, in <module>
ValueError: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Script Executor Traceback:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
 at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
 at System.Collections.Generic.List`1.get_Item(Int32 index)
 at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
 at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
 at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
 at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
 at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)

♻️ To Reproduce

No response

⏲️ Expected behavior

No response

🖥️ Hardware and Software Setup (please complete the following information)

==> Extension Search Paths
==> Extension Sources - Default
https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
Autodesk Revit 2024 | Version: 24.1.11.26 | Build: 20230911_1230(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2024\"
Autodesk Revit 2023 | Version: 23.0.11.19 | Build: 20220503_1030(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2023\"
2022.1.5 | Version: 22.1.50.17 | Build: 20230915_1530(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2022\"
==> Running Revit Instances
PID: 41152 | 2022.1.5 | Version: 22.1.50.17 | Build: 20230915_1530(x64) | Language: 0 | Path: "C:\Program Files\Autodesk\Revit 2022"
==> User Environment
Microsoft Windows 10 [Version 10.0.19045]
Executing User: xxx
Active User: xxx
Admin Access: No
%APPDATA%: "C:\Users\xxx\AppData\Roaming"
Latest Installed .Net Framework: 4.8
No .Net Target Packs are installed.
No .Ne-Core Target Packs are installed.
pyRevit CLI v4.8.15.24089+0912.f079f5fd51756b988a06d005d4f4cd2961f36e63

Additional context

No response

Hi @JerryWu25,
I'm sorry you're having troubles with that command.
I cannot test it right now, but in the meantime you could try to detect which element gives you troubles by adding the following before the line 243 of the script (ALT+click on the button to open the script folder)

print("Element", eltid, "Tagged local element Ids", elt.GetTaggedLocalElementIds())

In the output windows you should see a list of Element ......, the last one (but it might as well be the first) before the error is the one that gives you trouble.

If the end of the line is gibberish, try to use list(elt.GetTaggedLocalElementIds()) instead to make it a python list that should be printed more nicely.

Once you have the incriminating element Id, it will be easier to troubleshoot and reproduce the issue

Hi @sanzoghenzo , thanks for the hint, for some reason that "troublemaker" somehow disappeared this morning, we might accidentally fixed it, I will definitely try your tips if I see it again and I will reopen another case.

Thanks again!