Pyrevit: Duplicate schedule name with import from CSV makes pyrevit error

Created on 12 Aug 2020  路  8Comments  路  Source: eirannejad/pyRevit

Describe the bug
Trying to import a csv as a wall key schedule because the first try looks all wrong

To Reproduce
Import the same csv to the same category twice

Expected behavior
pyRevit should create a new schedule with an iteration in the name. For example

  • ScheduleFromCVS
  • ScheduleFromCSV(2)

Desktop (please complete the following information):

  • OS: Win10
  • pyRevit Version pyRevit 4.7.6:277:2020.2
  • pyRevit Environment: Open a command prompt and run the command below. Replace these lines with the results. Take a look at this markdown guide and wrap the command results in ``` when pasting here for correct formatting.

```Microsoft Windows [Version 10.0.17763.1339]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\xxx>pyrevit env ==> Registered Clones (full git repos) ==> Registered Clones (deployed from archive/image) master | Deploy: "basepublic" | Branch: "master" | Version: "4.7.6" | Path: "C:\Users\dli\AppData\Roaming\pyRevit-Master" ==> Attachments master | Product: "Autodesk Revit 2020" | Engine: 277 | Path: "C:\Users\dli\AppData\Roaming\pyRevit-Master" | Manifest: "C:\Users\dli\AppData\Roaming\Autodesk\Revit\Addins\2020\pyRevit.addin" master | Product: "2019.2.2 Hotfix" | Engine: 277 | Path: "C:\Users\dli\AppData\Roaming\pyRevit-Master" | Manifest: "C:\Users\dli\AppData\Roaming\Autodesk\Revit\Addins\2019\pyRevit.addin" master | Product: "2018.3.3 Security Fix" | Engine: 277 | Path: "C:\Users\dli\AppData\Roaming\pyRevit-Master" | Manifest: "C:\Users\dli\AppData\Roaming\Autodesk\Revit\Addins\2018\pyRevit.addin" master | Product: "2017.2.5 Security Fix" | Engine: 277 | Path: "C:\Users\dli\AppData\Roaming\pyRevit-Master" | Manifest: "C:\Users\dli\AppData\Roaming\Autodesk\Revit\Addins\2017\pyRevit.addin" ==> Installed Extensions ==> Default Extension Search Path C:\Users\dli\AppData\Roaming\pyRevit\Extensions ==> Extension Search Paths ==> Extension Sources - Default https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json ==> Extension Sources - Additional ==> Installed Revits Autodesk Revit 2021 | Version: 21.1.0.108 | Build: 20200708_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2021" Autodesk Revit 2020 | Version: 20.2.20.31 | Build: 20200426_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2020" 2019.2.2 Hotfix | Version: 19.2.20.24 | Build: 20190808_0900(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2019" 2018.3.3 Security Fix | Version: 18.3.3.18 | Build: 20190510_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2018" 2017.2.5 Security Fix | Version: 17.0.1169.0 | Build: 20190508_0315(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2017" ==> Running Revit Instances Error: Object reference not set to an instance of an object. Run with "--debug" option to see debug messages

Additional context
Here's the console text

锘縛``ERROR [pyrevit.revit.db.transaction] Error in Transaction Context. Rolling back changes. | :Name must be unique.
Parameter name: name

IronPython Traceback:
Traceback (most recent call last):
File "C:\Users\dli\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\views.stack\Schedules.pulldownCreate Schedule from CSV.pushbutton\script.py", line 160, in
File "C:\Users\dli\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\views.stack\Schedules.pulldownCreate Schedule from CSV.pushbutton\script.py", line 36, in create_key_schedule
Exception: Name must be unique.
Parameter name: name

Script Executor Traceback:
Autodesk.Revit.Exceptions.ArgumentException: Name must be unique.
Parameter name: name
at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.HandleException(InterpretedFrame frame, Exception exception)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2T0,T1,TRet
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)```

Enhancement

All 8 comments

Fixed and will be published with next release

of course the schedule might already be on a sheet, so even better would be if it asks whether it should overwrite or create a new schedule.

So the tool creates Key schedules. You can't have two key schedules feeding values to the same parameters. Only one can exist

Okay, sure. But is there is no way to replace the previous data with new data in the same schedule?

Great question. I need to look at the api. I just understood what your problem is. You have a schedule on a sheet that you don't want to delete every time there is new data. Got it! Sorry I'm a bit all over the place these days working on so many different things.

  • [ ] Okay the API supports removing rows in key schedules. I'll implement that and will rework the schedule conflict resolution logic

Brilliant! I look forward to seeing it sometime when someone submits a patch.

Fixed and will be published with next release

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Arsany123 picture Arsany123  路  4Comments

kuldeep3618x picture kuldeep3618x  路  4Comments

TheBIMsider picture TheBIMsider  路  5Comments

DuncanLithgow picture DuncanLithgow  路  3Comments

jkcameron picture jkcameron  路  5Comments